home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / python2.6 / dist-packages / xapian.pyc (.txt) < prev   
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  213.0 KB  |  5,625 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import _xapian
  5. import new
  6. new_instancemethod = new.instancemethod
  7.  
  8. try:
  9.     _swig_property = property
  10. except NameError:
  11.     pass
  12.  
  13.  
  14. def _swig_setattr_nondynamic(self, class_type, name, value, static = 1):
  15.     if name == 'thisown':
  16.         return self.this.own(value)
  17.     method = class_type.__swig_setmethods__.get(name, None)
  18.     if method:
  19.         return method(self, value)
  20.     if not static or hasattr(self, name):
  21.         self.__dict__[name] = value
  22.     else:
  23.         raise AttributeError('You cannot add attributes to %s' % self)
  24.     return method
  25.  
  26.  
  27. def _swig_setattr(self, class_type, name, value):
  28.     return _swig_setattr_nondynamic(self, class_type, name, value, 0)
  29.  
  30.  
  31. def _swig_getattr(self, class_type, name):
  32.     if name == 'thisown':
  33.         return self.this.own()
  34.     method = class_type.__swig_getmethods__.get(name, None)
  35.     if method:
  36.         return method(self)
  37.     raise AttributeError, name
  38.  
  39.  
  40. def _swig_repr(self):
  41.     
  42.     try:
  43.         strthis = 'proxy of ' + self.this.__repr__()
  44.     except:
  45.         strthis = ''
  46.  
  47.     return '<%s.%s; %s >' % (self.__class__.__module__, self.__class__.__name__, strthis)
  48.  
  49. import types
  50.  
  51. try:
  52.     _object = types.ObjectType
  53.     _newclass = 1
  54. except AttributeError:
  55.     
  56.     class _object:
  57.         pass
  58.  
  59.     _newclass = 0
  60.  
  61. del types
  62.  
  63. def _swig_setattr_nondynamic_method(set):
  64.     
  65.     def set_attr(self, name, value):
  66.         if name == 'thisown':
  67.             return self.this.own(value)
  68.         if hasattr(self, name) or name == 'this':
  69.             set(self, name, value)
  70.         else:
  71.             raise AttributeError('You cannot add attributes to %s' % self)
  72.         return name == 'thisown'
  73.  
  74.     return set_attr
  75.  
  76.  
  77. try:
  78.     import weakref
  79.     weakref_proxy = weakref.proxy
  80. except:
  81.     
  82.     weakref_proxy = lambda x: x
  83.  
  84.  
  85. class PySwigIterator(object):
  86.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  87.     
  88.     def __init__(self):
  89.         raise AttributeError, 'No constructor defined'
  90.  
  91.     __repr__ = _swig_repr
  92.     __swig_destroy__ = _xapian.delete_PySwigIterator
  93.     
  94.     def __iter__(self):
  95.         return self
  96.  
  97.  
  98. PySwigIterator.value = new_instancemethod(_xapian.PySwigIterator_value, None, PySwigIterator)
  99. PySwigIterator.incr = new_instancemethod(_xapian.PySwigIterator_incr, None, PySwigIterator)
  100. PySwigIterator.decr = new_instancemethod(_xapian.PySwigIterator_decr, None, PySwigIterator)
  101. PySwigIterator.distance = new_instancemethod(_xapian.PySwigIterator_distance, None, PySwigIterator)
  102. PySwigIterator.equal = new_instancemethod(_xapian.PySwigIterator_equal, None, PySwigIterator)
  103. PySwigIterator.copy = new_instancemethod(_xapian.PySwigIterator_copy, None, PySwigIterator)
  104. PySwigIterator.next = new_instancemethod(_xapian.PySwigIterator_next, None, PySwigIterator)
  105. PySwigIterator.previous = new_instancemethod(_xapian.PySwigIterator_previous, None, PySwigIterator)
  106. PySwigIterator.advance = new_instancemethod(_xapian.PySwigIterator_advance, None, PySwigIterator)
  107. PySwigIterator.__eq__ = new_instancemethod(_xapian.PySwigIterator___eq__, None, PySwigIterator)
  108. PySwigIterator.__ne__ = new_instancemethod(_xapian.PySwigIterator___ne__, None, PySwigIterator)
  109. PySwigIterator.__iadd__ = new_instancemethod(_xapian.PySwigIterator___iadd__, None, PySwigIterator)
  110. PySwigIterator.__isub__ = new_instancemethod(_xapian.PySwigIterator___isub__, None, PySwigIterator)
  111. PySwigIterator.__add__ = new_instancemethod(_xapian.PySwigIterator___add__, None, PySwigIterator)
  112. PySwigIterator.__sub__ = new_instancemethod(_xapian.PySwigIterator___sub__, None, PySwigIterator)
  113. PySwigIterator_swigregister = _xapian.PySwigIterator_swigregister
  114. PySwigIterator_swigregister(PySwigIterator)
  115. MSET_DID = _xapian.MSET_DID
  116. MSET_WT = _xapian.MSET_WT
  117. MSET_RANK = _xapian.MSET_RANK
  118. MSET_PERCENT = _xapian.MSET_PERCENT
  119. MSET_DOCUMENT = _xapian.MSET_DOCUMENT
  120. ESET_TNAME = _xapian.ESET_TNAME
  121. ESET_WT = _xapian.ESET_WT
  122.  
  123. class Error(Exception):
  124.     __swig_setmethods__ = { }
  125.     
  126.     __setattr__ = lambda self, name, value: _swig_setattr(self, Error, name, value)
  127.     __swig_getmethods__ = { }
  128.     
  129.     __getattr__ = lambda self, name: _swig_getattr(self, Error, name)
  130.     
  131.     def __init__(self):
  132.         raise AttributeError, 'No constructor defined'
  133.  
  134.     __repr__ = _swig_repr
  135.     __swig_destroy__ = _xapian.delete_Error
  136.  
  137. Error.get_type = new_instancemethod(_xapian.Error_get_type, None, Error)
  138. Error.get_msg = new_instancemethod(_xapian.Error_get_msg, None, Error)
  139. Error.get_context = new_instancemethod(_xapian.Error_get_context, None, Error)
  140. Error.get_error_string = new_instancemethod(_xapian.Error_get_error_string, None, Error)
  141. Error.get_errno = new_instancemethod(_xapian.Error_get_errno, None, Error)
  142. Error.__str__ = new_instancemethod(_xapian.Error___str__, None, Error)
  143. Error_swigregister = _xapian.Error_swigregister
  144. Error_swigregister(Error)
  145.  
  146. class LogicError(Error):
  147.     __swig_setmethods__ = { }
  148.     for _s in [
  149.         Error]:
  150.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  151.     
  152.     
  153.     __setattr__ = lambda self, name, value: _swig_setattr(self, LogicError, name, value)
  154.     __swig_getmethods__ = { }
  155.     for _s in [
  156.         Error]:
  157.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  158.     
  159.     
  160.     __getattr__ = lambda self, name: _swig_getattr(self, LogicError, name)
  161.     
  162.     def __init__(self):
  163.         raise AttributeError, 'No constructor defined'
  164.  
  165.     __repr__ = _swig_repr
  166.     __swig_destroy__ = _xapian.delete_LogicError
  167.  
  168. LogicError_swigregister = _xapian.LogicError_swigregister
  169. LogicError_swigregister(LogicError)
  170.  
  171. class RuntimeError(Error):
  172.     __swig_setmethods__ = { }
  173.     for _s in [
  174.         Error]:
  175.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  176.     
  177.     
  178.     __setattr__ = lambda self, name, value: _swig_setattr(self, RuntimeError, name, value)
  179.     __swig_getmethods__ = { }
  180.     for _s in [
  181.         Error]:
  182.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  183.     
  184.     
  185.     __getattr__ = lambda self, name: _swig_getattr(self, RuntimeError, name)
  186.     
  187.     def __init__(self):
  188.         raise AttributeError, 'No constructor defined'
  189.  
  190.     __repr__ = _swig_repr
  191.     __swig_destroy__ = _xapian.delete_RuntimeError
  192.  
  193. RuntimeError_swigregister = _xapian.RuntimeError_swigregister
  194. RuntimeError_swigregister(RuntimeError)
  195.  
  196. class AssertionError(LogicError):
  197.     __swig_setmethods__ = { }
  198.     for _s in [
  199.         LogicError]:
  200.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  201.     
  202.     
  203.     __setattr__ = lambda self, name, value: _swig_setattr(self, AssertionError, name, value)
  204.     __swig_getmethods__ = { }
  205.     for _s in [
  206.         LogicError]:
  207.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  208.     
  209.     
  210.     __getattr__ = lambda self, name: _swig_getattr(self, AssertionError, name)
  211.     __repr__ = _swig_repr
  212.     
  213.     def __init__(self, *args):
  214.         _xapian.AssertionError_swiginit(self, _xapian.new_AssertionError(*args))
  215.  
  216.     __swig_destroy__ = _xapian.delete_AssertionError
  217.  
  218. AssertionError_swigregister = _xapian.AssertionError_swigregister
  219. AssertionError_swigregister(AssertionError)
  220.  
  221. class InvalidArgumentError(LogicError):
  222.     __swig_setmethods__ = { }
  223.     for _s in [
  224.         LogicError]:
  225.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  226.     
  227.     
  228.     __setattr__ = lambda self, name, value: _swig_setattr(self, InvalidArgumentError, name, value)
  229.     __swig_getmethods__ = { }
  230.     for _s in [
  231.         LogicError]:
  232.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  233.     
  234.     
  235.     __getattr__ = lambda self, name: _swig_getattr(self, InvalidArgumentError, name)
  236.     __repr__ = _swig_repr
  237.     
  238.     def __init__(self, *args):
  239.         _xapian.InvalidArgumentError_swiginit(self, _xapian.new_InvalidArgumentError(*args))
  240.  
  241.     __swig_destroy__ = _xapian.delete_InvalidArgumentError
  242.  
  243. InvalidArgumentError_swigregister = _xapian.InvalidArgumentError_swigregister
  244. InvalidArgumentError_swigregister(InvalidArgumentError)
  245.  
  246. class InvalidOperationError(LogicError):
  247.     __swig_setmethods__ = { }
  248.     for _s in [
  249.         LogicError]:
  250.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  251.     
  252.     
  253.     __setattr__ = lambda self, name, value: _swig_setattr(self, InvalidOperationError, name, value)
  254.     __swig_getmethods__ = { }
  255.     for _s in [
  256.         LogicError]:
  257.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  258.     
  259.     
  260.     __getattr__ = lambda self, name: _swig_getattr(self, InvalidOperationError, name)
  261.     __repr__ = _swig_repr
  262.     
  263.     def __init__(self, *args):
  264.         _xapian.InvalidOperationError_swiginit(self, _xapian.new_InvalidOperationError(*args))
  265.  
  266.     __swig_destroy__ = _xapian.delete_InvalidOperationError
  267.  
  268. InvalidOperationError_swigregister = _xapian.InvalidOperationError_swigregister
  269. InvalidOperationError_swigregister(InvalidOperationError)
  270.  
  271. class UnimplementedError(LogicError):
  272.     __swig_setmethods__ = { }
  273.     for _s in [
  274.         LogicError]:
  275.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  276.     
  277.     
  278.     __setattr__ = lambda self, name, value: _swig_setattr(self, UnimplementedError, name, value)
  279.     __swig_getmethods__ = { }
  280.     for _s in [
  281.         LogicError]:
  282.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  283.     
  284.     
  285.     __getattr__ = lambda self, name: _swig_getattr(self, UnimplementedError, name)
  286.     __repr__ = _swig_repr
  287.     
  288.     def __init__(self, *args):
  289.         _xapian.UnimplementedError_swiginit(self, _xapian.new_UnimplementedError(*args))
  290.  
  291.     __swig_destroy__ = _xapian.delete_UnimplementedError
  292.  
  293. UnimplementedError_swigregister = _xapian.UnimplementedError_swigregister
  294. UnimplementedError_swigregister(UnimplementedError)
  295.  
  296. class DatabaseError(RuntimeError):
  297.     __swig_setmethods__ = { }
  298.     for _s in [
  299.         RuntimeError]:
  300.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  301.     
  302.     
  303.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseError, name, value)
  304.     __swig_getmethods__ = { }
  305.     for _s in [
  306.         RuntimeError]:
  307.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  308.     
  309.     
  310.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseError, name)
  311.     __repr__ = _swig_repr
  312.     
  313.     def __init__(self, *args):
  314.         _xapian.DatabaseError_swiginit(self, _xapian.new_DatabaseError(*args))
  315.  
  316.     __swig_destroy__ = _xapian.delete_DatabaseError
  317.  
  318. DatabaseError_swigregister = _xapian.DatabaseError_swigregister
  319. DatabaseError_swigregister(DatabaseError)
  320.  
  321. class DatabaseCorruptError(DatabaseError):
  322.     __swig_setmethods__ = { }
  323.     for _s in [
  324.         DatabaseError]:
  325.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  326.     
  327.     
  328.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseCorruptError, name, value)
  329.     __swig_getmethods__ = { }
  330.     for _s in [
  331.         DatabaseError]:
  332.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  333.     
  334.     
  335.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseCorruptError, name)
  336.     __repr__ = _swig_repr
  337.     
  338.     def __init__(self, *args):
  339.         _xapian.DatabaseCorruptError_swiginit(self, _xapian.new_DatabaseCorruptError(*args))
  340.  
  341.     __swig_destroy__ = _xapian.delete_DatabaseCorruptError
  342.  
  343. DatabaseCorruptError_swigregister = _xapian.DatabaseCorruptError_swigregister
  344. DatabaseCorruptError_swigregister(DatabaseCorruptError)
  345.  
  346. class DatabaseCreateError(DatabaseError):
  347.     __swig_setmethods__ = { }
  348.     for _s in [
  349.         DatabaseError]:
  350.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  351.     
  352.     
  353.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseCreateError, name, value)
  354.     __swig_getmethods__ = { }
  355.     for _s in [
  356.         DatabaseError]:
  357.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  358.     
  359.     
  360.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseCreateError, name)
  361.     __repr__ = _swig_repr
  362.     
  363.     def __init__(self, *args):
  364.         _xapian.DatabaseCreateError_swiginit(self, _xapian.new_DatabaseCreateError(*args))
  365.  
  366.     __swig_destroy__ = _xapian.delete_DatabaseCreateError
  367.  
  368. DatabaseCreateError_swigregister = _xapian.DatabaseCreateError_swigregister
  369. DatabaseCreateError_swigregister(DatabaseCreateError)
  370.  
  371. class DatabaseLockError(DatabaseError):
  372.     __swig_setmethods__ = { }
  373.     for _s in [
  374.         DatabaseError]:
  375.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  376.     
  377.     
  378.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseLockError, name, value)
  379.     __swig_getmethods__ = { }
  380.     for _s in [
  381.         DatabaseError]:
  382.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  383.     
  384.     
  385.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseLockError, name)
  386.     __repr__ = _swig_repr
  387.     
  388.     def __init__(self, *args):
  389.         _xapian.DatabaseLockError_swiginit(self, _xapian.new_DatabaseLockError(*args))
  390.  
  391.     __swig_destroy__ = _xapian.delete_DatabaseLockError
  392.  
  393. DatabaseLockError_swigregister = _xapian.DatabaseLockError_swigregister
  394. DatabaseLockError_swigregister(DatabaseLockError)
  395.  
  396. class DatabaseModifiedError(DatabaseError):
  397.     __swig_setmethods__ = { }
  398.     for _s in [
  399.         DatabaseError]:
  400.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  401.     
  402.     
  403.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseModifiedError, name, value)
  404.     __swig_getmethods__ = { }
  405.     for _s in [
  406.         DatabaseError]:
  407.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  408.     
  409.     
  410.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseModifiedError, name)
  411.     __repr__ = _swig_repr
  412.     
  413.     def __init__(self, *args):
  414.         _xapian.DatabaseModifiedError_swiginit(self, _xapian.new_DatabaseModifiedError(*args))
  415.  
  416.     __swig_destroy__ = _xapian.delete_DatabaseModifiedError
  417.  
  418. DatabaseModifiedError_swigregister = _xapian.DatabaseModifiedError_swigregister
  419. DatabaseModifiedError_swigregister(DatabaseModifiedError)
  420.  
  421. class DatabaseOpeningError(DatabaseError):
  422.     __swig_setmethods__ = { }
  423.     for _s in [
  424.         DatabaseError]:
  425.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  426.     
  427.     
  428.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseOpeningError, name, value)
  429.     __swig_getmethods__ = { }
  430.     for _s in [
  431.         DatabaseError]:
  432.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  433.     
  434.     
  435.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseOpeningError, name)
  436.     __repr__ = _swig_repr
  437.     
  438.     def __init__(self, *args):
  439.         _xapian.DatabaseOpeningError_swiginit(self, _xapian.new_DatabaseOpeningError(*args))
  440.  
  441.     __swig_destroy__ = _xapian.delete_DatabaseOpeningError
  442.  
  443. DatabaseOpeningError_swigregister = _xapian.DatabaseOpeningError_swigregister
  444. DatabaseOpeningError_swigregister(DatabaseOpeningError)
  445.  
  446. class DatabaseVersionError(DatabaseOpeningError):
  447.     __swig_setmethods__ = { }
  448.     for _s in [
  449.         DatabaseOpeningError]:
  450.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  451.     
  452.     
  453.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseVersionError, name, value)
  454.     __swig_getmethods__ = { }
  455.     for _s in [
  456.         DatabaseOpeningError]:
  457.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  458.     
  459.     
  460.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseVersionError, name)
  461.     __repr__ = _swig_repr
  462.     
  463.     def __init__(self, *args):
  464.         _xapian.DatabaseVersionError_swiginit(self, _xapian.new_DatabaseVersionError(*args))
  465.  
  466.     __swig_destroy__ = _xapian.delete_DatabaseVersionError
  467.  
  468. DatabaseVersionError_swigregister = _xapian.DatabaseVersionError_swigregister
  469. DatabaseVersionError_swigregister(DatabaseVersionError)
  470.  
  471. class DocNotFoundError(RuntimeError):
  472.     __swig_setmethods__ = { }
  473.     for _s in [
  474.         RuntimeError]:
  475.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  476.     
  477.     
  478.     __setattr__ = lambda self, name, value: _swig_setattr(self, DocNotFoundError, name, value)
  479.     __swig_getmethods__ = { }
  480.     for _s in [
  481.         RuntimeError]:
  482.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  483.     
  484.     
  485.     __getattr__ = lambda self, name: _swig_getattr(self, DocNotFoundError, name)
  486.     __repr__ = _swig_repr
  487.     
  488.     def __init__(self, *args):
  489.         _xapian.DocNotFoundError_swiginit(self, _xapian.new_DocNotFoundError(*args))
  490.  
  491.     __swig_destroy__ = _xapian.delete_DocNotFoundError
  492.  
  493. DocNotFoundError_swigregister = _xapian.DocNotFoundError_swigregister
  494. DocNotFoundError_swigregister(DocNotFoundError)
  495.  
  496. class FeatureUnavailableError(RuntimeError):
  497.     __swig_setmethods__ = { }
  498.     for _s in [
  499.         RuntimeError]:
  500.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  501.     
  502.     
  503.     __setattr__ = lambda self, name, value: _swig_setattr(self, FeatureUnavailableError, name, value)
  504.     __swig_getmethods__ = { }
  505.     for _s in [
  506.         RuntimeError]:
  507.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  508.     
  509.     
  510.     __getattr__ = lambda self, name: _swig_getattr(self, FeatureUnavailableError, name)
  511.     __repr__ = _swig_repr
  512.     
  513.     def __init__(self, *args):
  514.         _xapian.FeatureUnavailableError_swiginit(self, _xapian.new_FeatureUnavailableError(*args))
  515.  
  516.     __swig_destroy__ = _xapian.delete_FeatureUnavailableError
  517.  
  518. FeatureUnavailableError_swigregister = _xapian.FeatureUnavailableError_swigregister
  519. FeatureUnavailableError_swigregister(FeatureUnavailableError)
  520.  
  521. class InternalError(RuntimeError):
  522.     __swig_setmethods__ = { }
  523.     for _s in [
  524.         RuntimeError]:
  525.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  526.     
  527.     
  528.     __setattr__ = lambda self, name, value: _swig_setattr(self, InternalError, name, value)
  529.     __swig_getmethods__ = { }
  530.     for _s in [
  531.         RuntimeError]:
  532.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  533.     
  534.     
  535.     __getattr__ = lambda self, name: _swig_getattr(self, InternalError, name)
  536.     __repr__ = _swig_repr
  537.     
  538.     def __init__(self, *args):
  539.         _xapian.InternalError_swiginit(self, _xapian.new_InternalError(*args))
  540.  
  541.     __swig_destroy__ = _xapian.delete_InternalError
  542.  
  543. InternalError_swigregister = _xapian.InternalError_swigregister
  544. InternalError_swigregister(InternalError)
  545.  
  546. class NetworkError(RuntimeError):
  547.     __swig_setmethods__ = { }
  548.     for _s in [
  549.         RuntimeError]:
  550.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  551.     
  552.     
  553.     __setattr__ = lambda self, name, value: _swig_setattr(self, NetworkError, name, value)
  554.     __swig_getmethods__ = { }
  555.     for _s in [
  556.         RuntimeError]:
  557.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  558.     
  559.     
  560.     __getattr__ = lambda self, name: _swig_getattr(self, NetworkError, name)
  561.     __repr__ = _swig_repr
  562.     
  563.     def __init__(self, *args):
  564.         _xapian.NetworkError_swiginit(self, _xapian.new_NetworkError(*args))
  565.  
  566.     __swig_destroy__ = _xapian.delete_NetworkError
  567.  
  568. NetworkError_swigregister = _xapian.NetworkError_swigregister
  569. NetworkError_swigregister(NetworkError)
  570.  
  571. class NetworkTimeoutError(NetworkError):
  572.     __swig_setmethods__ = { }
  573.     for _s in [
  574.         NetworkError]:
  575.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  576.     
  577.     
  578.     __setattr__ = lambda self, name, value: _swig_setattr(self, NetworkTimeoutError, name, value)
  579.     __swig_getmethods__ = { }
  580.     for _s in [
  581.         NetworkError]:
  582.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  583.     
  584.     
  585.     __getattr__ = lambda self, name: _swig_getattr(self, NetworkTimeoutError, name)
  586.     __repr__ = _swig_repr
  587.     
  588.     def __init__(self, *args):
  589.         _xapian.NetworkTimeoutError_swiginit(self, _xapian.new_NetworkTimeoutError(*args))
  590.  
  591.     __swig_destroy__ = _xapian.delete_NetworkTimeoutError
  592.  
  593. NetworkTimeoutError_swigregister = _xapian.NetworkTimeoutError_swigregister
  594. NetworkTimeoutError_swigregister(NetworkTimeoutError)
  595.  
  596. class QueryParserError(RuntimeError):
  597.     __swig_setmethods__ = { }
  598.     for _s in [
  599.         RuntimeError]:
  600.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  601.     
  602.     
  603.     __setattr__ = lambda self, name, value: _swig_setattr(self, QueryParserError, name, value)
  604.     __swig_getmethods__ = { }
  605.     for _s in [
  606.         RuntimeError]:
  607.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  608.     
  609.     
  610.     __getattr__ = lambda self, name: _swig_getattr(self, QueryParserError, name)
  611.     __repr__ = _swig_repr
  612.     
  613.     def __init__(self, *args):
  614.         _xapian.QueryParserError_swiginit(self, _xapian.new_QueryParserError(*args))
  615.  
  616.     __swig_destroy__ = _xapian.delete_QueryParserError
  617.  
  618. QueryParserError_swigregister = _xapian.QueryParserError_swigregister
  619. QueryParserError_swigregister(QueryParserError)
  620.  
  621. class RangeError(RuntimeError):
  622.     __swig_setmethods__ = { }
  623.     for _s in [
  624.         RuntimeError]:
  625.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  626.     
  627.     
  628.     __setattr__ = lambda self, name, value: _swig_setattr(self, RangeError, name, value)
  629.     __swig_getmethods__ = { }
  630.     for _s in [
  631.         RuntimeError]:
  632.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  633.     
  634.     
  635.     __getattr__ = lambda self, name: _swig_getattr(self, RangeError, name)
  636.     __repr__ = _swig_repr
  637.     
  638.     def __init__(self, *args):
  639.         _xapian.RangeError_swiginit(self, _xapian.new_RangeError(*args))
  640.  
  641.     __swig_destroy__ = _xapian.delete_RangeError
  642.  
  643. RangeError_swigregister = _xapian.RangeError_swigregister
  644. RangeError_swigregister(RangeError)
  645. version_string = _xapian.version_string
  646. major_version = _xapian.major_version
  647. minor_version = _xapian.minor_version
  648. revision = _xapian.revision
  649. xapian_version_string = _xapian.xapian_version_string
  650. xapian_major_version = _xapian.xapian_major_version
  651. xapian_minor_version = _xapian.xapian_minor_version
  652. xapian_revision = _xapian.xapian_revision
  653.  
  654. class PositionIterator(object):
  655.     '''
  656.     An iterator pointing to items in a list of positions. 
  657.     '''
  658.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  659.     __repr__ = _swig_repr
  660.     
  661.     def __init__(self, *args):
  662.         '''
  663.         Copying is allowed.
  664.  
  665.         Xapian::PositionIterator::PositionIterator(const PositionIterator &o)
  666.  
  667.         The internals are reference counted, so copying is also cheap. 
  668.         '''
  669.         _xapian.PositionIterator_swiginit(self, _xapian.new_PositionIterator(*args))
  670.  
  671.     __swig_destroy__ = _xapian.delete_PositionIterator
  672.     
  673.     def skip_to(*args):
  674.         '''
  675.         void
  676.         Xapian::PositionIterator::skip_to(Xapian::termpos pos) 
  677.         '''
  678.         return _xapian.PositionIterator_skip_to(*args)
  679.  
  680.     
  681.     def __str__(*args):
  682.         '''
  683.         Return a string describing this object.
  684.  
  685.         std::string Xapian::PositionIterator::get_description() const 
  686.         '''
  687.         return _xapian.PositionIterator___str__(*args)
  688.  
  689.     
  690.     def get_description(*args):
  691.         '''
  692.         Return a string describing this object.
  693.  
  694.         std::string Xapian::PositionIterator::get_description() const 
  695.         '''
  696.         return _xapian.PositionIterator_get_description(*args)
  697.  
  698.  
  699. PositionIterator.get_termpos = new_instancemethod(_xapian.PositionIterator_get_termpos, None, PositionIterator)
  700. PositionIterator.next = new_instancemethod(_xapian.PositionIterator_next, None, PositionIterator)
  701. PositionIterator.equals = new_instancemethod(_xapian.PositionIterator_equals, None, PositionIterator)
  702. PositionIterator.skip_to = new_instancemethod(_xapian.PositionIterator_skip_to, None, PositionIterator)
  703. PositionIterator.__str__ = new_instancemethod(_xapian.PositionIterator___str__, None, PositionIterator)
  704. PositionIterator.get_description = new_instancemethod(_xapian.PositionIterator_get_description, None, PositionIterator)
  705. PositionIterator.__eq__ = new_instancemethod(_xapian.PositionIterator___eq__, None, PositionIterator)
  706. PositionIterator.__ne__ = new_instancemethod(_xapian.PositionIterator___ne__, None, PositionIterator)
  707. PositionIterator_swigregister = _xapian.PositionIterator_swigregister
  708. PositionIterator_swigregister(PositionIterator)
  709. cvar = _xapian.cvar
  710. BAD_VALUENO = cvar.BAD_VALUENO
  711.  
  712. class PostingIterator(object):
  713.     '''
  714.     An iterator pointing to items in a list of postings. 
  715.     '''
  716.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  717.     __repr__ = _swig_repr
  718.     __swig_destroy__ = _xapian.delete_PostingIterator
  719.     
  720.     def __init__(self, *args):
  721.         '''
  722.         Copying is allowed.
  723.  
  724.         Xapian::PostingIterator::PostingIterator(const PostingIterator &other)
  725.  
  726.         The internals are reference counted, so copying is also cheap. 
  727.         '''
  728.         _xapian.PostingIterator_swiginit(self, _xapian.new_PostingIterator(*args))
  729.  
  730.     
  731.     def skip_to(*args):
  732.         """
  733.         Skip the iterator to document did, or the first document after did if
  734.         did isn't in the list of documents being iterated.
  735.  
  736.         void Xapian::PostingIterator::skip_to(Xapian::docid did) 
  737.         """
  738.         return _xapian.PostingIterator_skip_to(*args)
  739.  
  740.     
  741.     def get_doclength(*args):
  742.         '''
  743.         Get the length of the document at the current position in the
  744.         postlist.
  745.  
  746.         Xapian::doclength Xapian::PostingIterator::get_doclength() const
  747.  
  748.         This information may be stored in the postlist, in which case this
  749.         lookup should be extremely fast (indeed, not require further disk
  750.         access). If the information is not present in the postlist, it will be
  751.         retrieved from the database, at a greater performance cost. 
  752.         '''
  753.         return _xapian.PostingIterator_get_doclength(*args)
  754.  
  755.     
  756.     def get_wdf(*args):
  757.         '''
  758.         Get the within document frequency of the document at the current
  759.         position in the postlist.
  760.  
  761.         Xapian::termcount Xapian::PostingIterator::get_wdf() const 
  762.         '''
  763.         return _xapian.PostingIterator_get_wdf(*args)
  764.  
  765.     
  766.     def positionlist_begin(*args):
  767.         '''
  768.         Return PositionIterator pointing to start of positionlist for current
  769.         document.
  770.  
  771.         PositionIterator Xapian::PostingIterator::positionlist_begin() const
  772.  
  773.         '''
  774.         return _xapian.PostingIterator_positionlist_begin(*args)
  775.  
  776.     
  777.     def positionlist_end(*args):
  778.         '''
  779.         Return PositionIterator pointing to end of positionlist for current
  780.         document.
  781.  
  782.         PositionIterator Xapian::PostingIterator::positionlist_end() const 
  783.         '''
  784.         return _xapian.PostingIterator_positionlist_end(*args)
  785.  
  786.     
  787.     def __str__(*args):
  788.         '''
  789.         Return a string describing this object.
  790.  
  791.         std::string Xapian::PostingIterator::get_description() const 
  792.         '''
  793.         return _xapian.PostingIterator___str__(*args)
  794.  
  795.     
  796.     def get_description(*args):
  797.         '''
  798.         Return a string describing this object.
  799.  
  800.         std::string Xapian::PostingIterator::get_description() const 
  801.         '''
  802.         return _xapian.PostingIterator_get_description(*args)
  803.  
  804.  
  805. PostingIterator.skip_to = new_instancemethod(_xapian.PostingIterator_skip_to, None, PostingIterator)
  806. PostingIterator.get_doclength = new_instancemethod(_xapian.PostingIterator_get_doclength, None, PostingIterator)
  807. PostingIterator.get_wdf = new_instancemethod(_xapian.PostingIterator_get_wdf, None, PostingIterator)
  808. PostingIterator.positionlist_begin = new_instancemethod(_xapian.PostingIterator_positionlist_begin, None, PostingIterator)
  809. PostingIterator.positionlist_end = new_instancemethod(_xapian.PostingIterator_positionlist_end, None, PostingIterator)
  810. PostingIterator.__str__ = new_instancemethod(_xapian.PostingIterator___str__, None, PostingIterator)
  811. PostingIterator.get_description = new_instancemethod(_xapian.PostingIterator_get_description, None, PostingIterator)
  812. PostingIterator.__eq__ = new_instancemethod(_xapian.PostingIterator___eq__, None, PostingIterator)
  813. PostingIterator.__ne__ = new_instancemethod(_xapian.PostingIterator___ne__, None, PostingIterator)
  814. PostingIterator.get_docid = new_instancemethod(_xapian.PostingIterator_get_docid, None, PostingIterator)
  815. PostingIterator.next = new_instancemethod(_xapian.PostingIterator_next, None, PostingIterator)
  816. PostingIterator.equals = new_instancemethod(_xapian.PostingIterator_equals, None, PostingIterator)
  817. PostingIterator_swigregister = _xapian.PostingIterator_swigregister
  818. PostingIterator_swigregister(PostingIterator)
  819. __eq__ = _xapian.__eq__
  820. __ne__ = _xapian.__ne__
  821.  
  822. class TermIterator(object):
  823.     '''
  824.     An iterator pointing to items in a list of terms. 
  825.     '''
  826.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  827.     __repr__ = _swig_repr
  828.     
  829.     def __init__(self, *args):
  830.         '''
  831.         Copying is allowed.
  832.  
  833.         Xapian::TermIterator::TermIterator(const TermIterator &other)
  834.  
  835.         The internals are reference counted, so copying is also cheap. 
  836.         '''
  837.         _xapian.TermIterator_swiginit(self, _xapian.new_TermIterator(*args))
  838.  
  839.     __swig_destroy__ = _xapian.delete_TermIterator
  840.     
  841.     def skip_to(*args):
  842.         """
  843.         Skip the iterator to term tname, or the first term after tname if
  844.         tname isn't in the list of terms being iterated.
  845.  
  846.         void Xapian::TermIterator::skip_to(const std::string &tname) 
  847.         """
  848.         return _xapian.TermIterator_skip_to(*args)
  849.  
  850.     
  851.     def get_wdf(*args):
  852.         '''
  853.         Return the wdf of the current term (if meaningful).
  854.  
  855.         Xapian::termcount Xapian::TermIterator::get_wdf() const
  856.  
  857.         The wdf (within document frequency) is the number of occurences of a
  858.         term in a particular document. 
  859.         '''
  860.         return _xapian.TermIterator_get_wdf(*args)
  861.  
  862.     
  863.     def get_termfreq(*args):
  864.         '''
  865.         Return the term frequency of the current term (if meaningful).
  866.  
  867.         Xapian::doccount Xapian::TermIterator::get_termfreq() const
  868.  
  869.         The term frequency is the number of documents which a term indexes. 
  870.         '''
  871.         return _xapian.TermIterator_get_termfreq(*args)
  872.  
  873.     
  874.     def positionlist_begin(*args):
  875.         '''
  876.         Return PositionIterator pointing to start of positionlist for current
  877.         term.
  878.  
  879.         PositionIterator Xapian::TermIterator::positionlist_begin() const 
  880.         '''
  881.         return _xapian.TermIterator_positionlist_begin(*args)
  882.  
  883.     
  884.     def positionlist_end(*args):
  885.         '''
  886.         Return PositionIterator pointing to end of positionlist for current
  887.         term.
  888.  
  889.         PositionIterator Xapian::TermIterator::positionlist_end() const 
  890.         '''
  891.         return _xapian.TermIterator_positionlist_end(*args)
  892.  
  893.     
  894.     def __str__(*args):
  895.         '''
  896.         Return a string describing this object.
  897.  
  898.         std::string Xapian::TermIterator::get_description() const 
  899.         '''
  900.         return _xapian.TermIterator___str__(*args)
  901.  
  902.     
  903.     def get_description(*args):
  904.         '''
  905.         Return a string describing this object.
  906.  
  907.         std::string Xapian::TermIterator::get_description() const 
  908.         '''
  909.         return _xapian.TermIterator_get_description(*args)
  910.  
  911.  
  912. TermIterator.get_term = new_instancemethod(_xapian.TermIterator_get_term, None, TermIterator)
  913. TermIterator.next = new_instancemethod(_xapian.TermIterator_next, None, TermIterator)
  914. TermIterator.equals = new_instancemethod(_xapian.TermIterator_equals, None, TermIterator)
  915. TermIterator.skip_to = new_instancemethod(_xapian.TermIterator_skip_to, None, TermIterator)
  916. TermIterator.get_wdf = new_instancemethod(_xapian.TermIterator_get_wdf, None, TermIterator)
  917. TermIterator.get_termfreq = new_instancemethod(_xapian.TermIterator_get_termfreq, None, TermIterator)
  918. TermIterator.positionlist_begin = new_instancemethod(_xapian.TermIterator_positionlist_begin, None, TermIterator)
  919. TermIterator.positionlist_end = new_instancemethod(_xapian.TermIterator_positionlist_end, None, TermIterator)
  920. TermIterator.__str__ = new_instancemethod(_xapian.TermIterator___str__, None, TermIterator)
  921. TermIterator.get_description = new_instancemethod(_xapian.TermIterator_get_description, None, TermIterator)
  922. TermIterator.__eq__ = new_instancemethod(_xapian.TermIterator___eq__, None, TermIterator)
  923. TermIterator.__ne__ = new_instancemethod(_xapian.TermIterator___ne__, None, TermIterator)
  924. TermIterator_swigregister = _xapian.TermIterator_swigregister
  925. TermIterator_swigregister(TermIterator)
  926.  
  927. class ValueIterator(object):
  928.     '''
  929.     An iterator pointing to values associated with a document. 
  930.     '''
  931.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  932.     __repr__ = _swig_repr
  933.     
  934.     def __init__(self, *args):
  935.         '''
  936.         Copying is allowed (and is cheap).
  937.  
  938.         Xapian::ValueIterator::ValueIterator(const ValueIterator &other) 
  939.         '''
  940.         _xapian.ValueIterator_swiginit(self, _xapian.new_ValueIterator(*args))
  941.  
  942.     __swig_destroy__ = _xapian.delete_ValueIterator
  943.     
  944.     def get_valueno(*args):
  945.         '''
  946.         Get the number of the value at the current position.
  947.  
  948.         Xapian::valueno Xapian::ValueIterator::get_valueno() const 
  949.         '''
  950.         return _xapian.ValueIterator_get_valueno(*args)
  951.  
  952.     
  953.     def __str__(*args):
  954.         '''
  955.         Return a string describing this object.
  956.  
  957.         std::string Xapian::ValueIterator::get_description() const 
  958.         '''
  959.         return _xapian.ValueIterator___str__(*args)
  960.  
  961.     
  962.     def get_description(*args):
  963.         '''
  964.         Return a string describing this object.
  965.  
  966.         std::string Xapian::ValueIterator::get_description() const 
  967.         '''
  968.         return _xapian.ValueIterator_get_description(*args)
  969.  
  970.  
  971. ValueIterator.get_value = new_instancemethod(_xapian.ValueIterator_get_value, None, ValueIterator)
  972. ValueIterator.next = new_instancemethod(_xapian.ValueIterator_next, None, ValueIterator)
  973. ValueIterator.equals = new_instancemethod(_xapian.ValueIterator_equals, None, ValueIterator)
  974. ValueIterator.get_valueno = new_instancemethod(_xapian.ValueIterator_get_valueno, None, ValueIterator)
  975. ValueIterator.__str__ = new_instancemethod(_xapian.ValueIterator___str__, None, ValueIterator)
  976. ValueIterator.get_description = new_instancemethod(_xapian.ValueIterator_get_description, None, ValueIterator)
  977. ValueIterator.__eq__ = new_instancemethod(_xapian.ValueIterator___eq__, None, ValueIterator)
  978. ValueIterator.__ne__ = new_instancemethod(_xapian.ValueIterator___ne__, None, ValueIterator)
  979. ValueIterator_swigregister = _xapian.ValueIterator_swigregister
  980. ValueIterator_swigregister(ValueIterator)
  981.  
  982. class Document(object):
  983.     '''
  984.     A document in the database - holds data, values, terms, and postings.
  985.  
  986.     '''
  987.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  988.     __repr__ = _swig_repr
  989.     
  990.     def __init__(self, *args):
  991.         '''
  992.         Make a new empty Document.
  993.  
  994.         Xapian::Document::Document() 
  995.         '''
  996.         _xapian.Document_swiginit(self, _xapian.new_Document(*args))
  997.  
  998.     __swig_destroy__ = _xapian.delete_Document
  999.     
  1000.     def get_value(*args):
  1001.         '''
  1002.         Get value by number.
  1003.  
  1004.         std::string Xapian::Document::get_value(Xapian::valueno valueno) const
  1005.  
  1006.         Returns an empty string if no value with the given number is present
  1007.         in the document.
  1008.  
  1009.         Parameters:
  1010.         -----------
  1011.  
  1012.         valueno:  The number of the value. 
  1013.         '''
  1014.         return _xapian.Document_get_value(*args)
  1015.  
  1016.     
  1017.     def add_value(*args):
  1018.         '''
  1019.         Add a new value.
  1020.  
  1021.         void Xapian::Document::add_value(Xapian::valueno valueno, const
  1022.         std::string &value)
  1023.  
  1024.         It will replace any existing value with the same number. 
  1025.         '''
  1026.         return _xapian.Document_add_value(*args)
  1027.  
  1028.     
  1029.     def remove_value(*args):
  1030.         '''
  1031.         Remove any value with the given number.
  1032.  
  1033.         void Xapian::Document::remove_value(Xapian::valueno valueno) 
  1034.         '''
  1035.         return _xapian.Document_remove_value(*args)
  1036.  
  1037.     
  1038.     def clear_values(*args):
  1039.         '''
  1040.         Remove all values associated with the document.
  1041.  
  1042.         void Xapian::Document::clear_values() 
  1043.         '''
  1044.         return _xapian.Document_clear_values(*args)
  1045.  
  1046.     
  1047.     def get_data(*args):
  1048.         """
  1049.         Get data stored in the document.
  1050.  
  1051.         std::string Xapian::Document::get_data() const
  1052.  
  1053.         This is a potentially expensive operation, and shouldn't normally be
  1054.         used in a match decider functor. Put data for use by match deciders in
  1055.         a value instead. 
  1056.         """
  1057.         return _xapian.Document_get_data(*args)
  1058.  
  1059.     
  1060.     def set_data(*args):
  1061.         '''
  1062.         Set data stored in the document.
  1063.  
  1064.         void Xapian::Document::set_data(const std::string &data) 
  1065.         '''
  1066.         return _xapian.Document_set_data(*args)
  1067.  
  1068.     
  1069.     def add_posting(*args):
  1070.         '''
  1071.         Add an occurrence of a term at a particular position.
  1072.  
  1073.         void Xapian::Document::add_posting(const std::string &tname,
  1074.         Xapian::termpos tpos, Xapian::termcount wdfinc=1)
  1075.  
  1076.         Multiple occurrences of the term at the same position are represented
  1077.         only once in the positional information, but do increase the wdf.
  1078.  
  1079.         If the term is not already in the document, it will be added to it.
  1080.  
  1081.         Parameters:
  1082.         -----------
  1083.  
  1084.         tname:  The name of the term.
  1085.  
  1086.         tpos:  The position of the term.
  1087.  
  1088.         wdfinc:  The increment that will be applied to the wdf for this term.
  1089.  
  1090.         '''
  1091.         return _xapian.Document_add_posting(*args)
  1092.  
  1093.     
  1094.     def add_term(*args):
  1095.         '''
  1096.         Add a term to the document, without positional information.
  1097.  
  1098.         void Xapian::Document::add_term(const std::string &tname,
  1099.         Xapian::termcount wdfinc=1)
  1100.  
  1101.         Any existing positional information for the term will be left
  1102.         unmodified.
  1103.  
  1104.         Parameters:
  1105.         -----------
  1106.  
  1107.         tname:  The name of the term.
  1108.  
  1109.         wdfinc:  The increment that will be applied to the wdf for this term.
  1110.  
  1111.         '''
  1112.         return _xapian.Document_add_term(*args)
  1113.  
  1114.     
  1115.     def remove_posting(*args):
  1116.         '''
  1117.         Remove a posting of a term from the document.
  1118.  
  1119.         void Xapian::Document::remove_posting(const std::string &tname,
  1120.         Xapian::termpos tpos, Xapian::termcount wdfdec=1)
  1121.  
  1122.         Note that the term will still index the document even if all
  1123.         occurrences are removed. To remove a term from a document completely,
  1124.         use remove_term().
  1125.  
  1126.         Parameters:
  1127.         -----------
  1128.  
  1129.         tname:  The name of the term.
  1130.  
  1131.         tpos:  The position of the term.
  1132.  
  1133.         wdfdec:  The decrement that will be applied to the wdf when removing
  1134.         this posting. The wdf will not go below the value of 0.
  1135.  
  1136.         Parameters:
  1137.         -----------
  1138.  
  1139.         Xapian::InvalidArgumentError:  will be thrown if the term is not at
  1140.         the position specified in the position list for this term in this
  1141.         document.
  1142.  
  1143.         Xapian::InvalidArgumentError:  will be thrown if the term is not in
  1144.         the document 
  1145.         '''
  1146.         return _xapian.Document_remove_posting(*args)
  1147.  
  1148.     
  1149.     def remove_term(*args):
  1150.         '''
  1151.         Remove a term and all postings associated with it.
  1152.  
  1153.         void Xapian::Document::remove_term(const std::string &tname)
  1154.  
  1155.         Parameters:
  1156.         -----------
  1157.  
  1158.         tname:  The name of the term.
  1159.  
  1160.         Parameters:
  1161.         -----------
  1162.  
  1163.         Xapian::InvalidArgumentError:  will be thrown if the term is not in
  1164.         the document 
  1165.         '''
  1166.         return _xapian.Document_remove_term(*args)
  1167.  
  1168.     
  1169.     def clear_terms(*args):
  1170.         '''
  1171.         Remove all terms (and postings) from the document.
  1172.  
  1173.         void Xapian::Document::clear_terms() 
  1174.         '''
  1175.         return _xapian.Document_clear_terms(*args)
  1176.  
  1177.     
  1178.     def termlist_count(*args):
  1179.         '''
  1180.         The length of the termlist - i.e.
  1181.  
  1182.         Xapian::termcount Xapian::Document::termlist_count() const
  1183.  
  1184.         the number of different terms which index this document. 
  1185.         '''
  1186.         return _xapian.Document_termlist_count(*args)
  1187.  
  1188.     
  1189.     def termlist_begin(*args):
  1190.         '''
  1191.         Iterator for the terms in this document.
  1192.  
  1193.         TermIterator Xapian::Document::termlist_begin() const 
  1194.         '''
  1195.         return _xapian.Document_termlist_begin(*args)
  1196.  
  1197.     
  1198.     def termlist_end(*args):
  1199.         '''
  1200.         Equivalent end iterator for termlist_begin().
  1201.  
  1202.         TermIterator Xapian::Document::termlist_end() const 
  1203.         '''
  1204.         return _xapian.Document_termlist_end(*args)
  1205.  
  1206.     
  1207.     def values_count(*args):
  1208.         '''
  1209.         Count the values in this document.
  1210.  
  1211.         Xapian::termcount Xapian::Document::values_count() const 
  1212.         '''
  1213.         return _xapian.Document_values_count(*args)
  1214.  
  1215.     
  1216.     def values_begin(*args):
  1217.         '''
  1218.         Iterator for the values in this document.
  1219.  
  1220.         ValueIterator Xapian::Document::values_begin() const 
  1221.         '''
  1222.         return _xapian.Document_values_begin(*args)
  1223.  
  1224.     
  1225.     def values_end(*args):
  1226.         '''
  1227.         Equivalent end iterator for values_begin().
  1228.  
  1229.         ValueIterator Xapian::Document::values_end() const 
  1230.         '''
  1231.         return _xapian.Document_values_end(*args)
  1232.  
  1233.     
  1234.     def get_docid(*args):
  1235.         '''
  1236.         Get the document id which is associated with this document (if any).
  1237.  
  1238.         docid Xapian::Document::get_docid() const
  1239.  
  1240.         NB If multiple databases are being searched together, then this will
  1241.         be the document id in the individual database, not the merged
  1242.         database!
  1243.  
  1244.         If this document came from a database, return the document id in that
  1245.         database. Otherwise, return 0. 
  1246.         '''
  1247.         return _xapian.Document_get_docid(*args)
  1248.  
  1249.     
  1250.     def __str__(*args):
  1251.         '''
  1252.         Return a string describing this object.
  1253.  
  1254.         std::string Xapian::Document::get_description() const 
  1255.         '''
  1256.         return _xapian.Document___str__(*args)
  1257.  
  1258.     
  1259.     def get_description(*args):
  1260.         '''
  1261.         Return a string describing this object.
  1262.  
  1263.         std::string Xapian::Document::get_description() const 
  1264.         '''
  1265.         return _xapian.Document_get_description(*args)
  1266.  
  1267.  
  1268. Document.get_value = new_instancemethod(_xapian.Document_get_value, None, Document)
  1269. Document.add_value = new_instancemethod(_xapian.Document_add_value, None, Document)
  1270. Document.remove_value = new_instancemethod(_xapian.Document_remove_value, None, Document)
  1271. Document.clear_values = new_instancemethod(_xapian.Document_clear_values, None, Document)
  1272. Document.get_data = new_instancemethod(_xapian.Document_get_data, None, Document)
  1273. Document.set_data = new_instancemethod(_xapian.Document_set_data, None, Document)
  1274. Document.add_posting = new_instancemethod(_xapian.Document_add_posting, None, Document)
  1275. Document.add_term = new_instancemethod(_xapian.Document_add_term, None, Document)
  1276. Document.remove_posting = new_instancemethod(_xapian.Document_remove_posting, None, Document)
  1277. Document.remove_term = new_instancemethod(_xapian.Document_remove_term, None, Document)
  1278. Document.clear_terms = new_instancemethod(_xapian.Document_clear_terms, None, Document)
  1279. Document.termlist_count = new_instancemethod(_xapian.Document_termlist_count, None, Document)
  1280. Document.termlist_begin = new_instancemethod(_xapian.Document_termlist_begin, None, Document)
  1281. Document.termlist_end = new_instancemethod(_xapian.Document_termlist_end, None, Document)
  1282. Document.values_count = new_instancemethod(_xapian.Document_values_count, None, Document)
  1283. Document.values_begin = new_instancemethod(_xapian.Document_values_begin, None, Document)
  1284. Document.values_end = new_instancemethod(_xapian.Document_values_end, None, Document)
  1285. Document.get_docid = new_instancemethod(_xapian.Document_get_docid, None, Document)
  1286. Document.__str__ = new_instancemethod(_xapian.Document___str__, None, Document)
  1287. Document.get_description = new_instancemethod(_xapian.Document_get_description, None, Document)
  1288. Document_swigregister = _xapian.Document_swigregister
  1289. Document_swigregister(Document)
  1290.  
  1291. class MSet(object):
  1292.     '''
  1293.     A match set ( MSet).
  1294.  
  1295.     This class represents (a portion of) the results of a query. 
  1296.     '''
  1297.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  1298.     __repr__ = _swig_repr
  1299.     
  1300.     def __init__(self, *args):
  1301.         '''
  1302.         Copying is allowed (and is cheap).
  1303.  
  1304.         Xapian::MSet::MSet(const MSet &other) 
  1305.         '''
  1306.         _xapian.MSet_swiginit(self, _xapian.new_MSet(*args))
  1307.  
  1308.     __swig_destroy__ = _xapian.delete_MSet
  1309.     
  1310.     def fetch(*args):
  1311.         '''
  1312.         Fetch all the items in the MSet.
  1313.  
  1314.         void Xapian::MSet::fetch() const 
  1315.         '''
  1316.         return _xapian.MSet_fetch(*args)
  1317.  
  1318.     
  1319.     def convert_to_percent(*args):
  1320.         '''
  1321.         Return the percentage score for a particular item.
  1322.  
  1323.         Xapian::percent Xapian::MSet::convert_to_percent(const MSetIterator
  1324.         &it) const 
  1325.         '''
  1326.         return _xapian.MSet_convert_to_percent(*args)
  1327.  
  1328.     
  1329.     def get_termfreq(*args):
  1330.         '''
  1331.         Return the term frequency of the given query term.
  1332.  
  1333.         Xapian::doccount Xapian::MSet::get_termfreq(const std::string &tname)
  1334.         const
  1335.  
  1336.         Parameters:
  1337.         -----------
  1338.  
  1339.         tname:  The term to look for.
  1340.  
  1341.         Parameters:
  1342.         -----------
  1343.  
  1344.         Xapian::InvalidArgumentError:  is thrown if the term was not in the
  1345.         query. 
  1346.         '''
  1347.         return _xapian.MSet_get_termfreq(*args)
  1348.  
  1349.     
  1350.     def get_termweight(*args):
  1351.         '''
  1352.         Return the term weight of the given query term.
  1353.  
  1354.         Xapian::weight Xapian::MSet::get_termweight(const std::string &tname)
  1355.         const
  1356.  
  1357.         Parameters:
  1358.         -----------
  1359.  
  1360.         tname:  The term to look for.
  1361.  
  1362.         Parameters:
  1363.         -----------
  1364.  
  1365.         Xapian::InvalidArgumentError:  is thrown if the term was not in the
  1366.         query. 
  1367.         '''
  1368.         return _xapian.MSet_get_termweight(*args)
  1369.  
  1370.     
  1371.     def get_firstitem(*args):
  1372.         '''
  1373.         The index of the first item in the result which was put into the MSet.
  1374.  
  1375.         Xapian::doccount Xapian::MSet::get_firstitem() const
  1376.  
  1377.         This corresponds to the parameter "first" specified in
  1378.         Xapian::Enquire::get_mset(). A value of 0 corresponds to the highest
  1379.         result being the first item in the MSet. 
  1380.         '''
  1381.         return _xapian.MSet_get_firstitem(*args)
  1382.  
  1383.     
  1384.     def get_matches_lower_bound(*args):
  1385.         '''
  1386.         A lower bound on the number of documents in the database which match
  1387.         the query.
  1388.  
  1389.         Xapian::doccount Xapian::MSet::get_matches_lower_bound() const
  1390.  
  1391.         This figure takes into account collapsing of duplicates, and weighting
  1392.         cutoff values.
  1393.  
  1394.         This number is usually considerably less than the actual number of
  1395.         documents which match the query. 
  1396.         '''
  1397.         return _xapian.MSet_get_matches_lower_bound(*args)
  1398.  
  1399.     
  1400.     def get_matches_estimated(*args):
  1401.         '''
  1402.         An estimate for the number of documents in the database which match
  1403.         the query.
  1404.  
  1405.         Xapian::doccount Xapian::MSet::get_matches_estimated() const
  1406.  
  1407.         This figure takes into account collapsing of duplicates, and weighting
  1408.         cutoff values.
  1409.  
  1410.         This value is returned because there is sometimes a request to display
  1411.         such information. However, our experience is that presenting this
  1412.         value to users causes them to worry about the large number of results,
  1413.         rather than how useful those at the top of the result set are, and is
  1414.         thus undesirable. 
  1415.         '''
  1416.         return _xapian.MSet_get_matches_estimated(*args)
  1417.  
  1418.     
  1419.     def get_matches_upper_bound(*args):
  1420.         '''
  1421.         An upper bound on the number of documents in the database which match
  1422.         the query.
  1423.  
  1424.         Xapian::doccount Xapian::MSet::get_matches_upper_bound() const
  1425.  
  1426.         This figure takes into account collapsing of duplicates, and weighting
  1427.         cutoff values.
  1428.  
  1429.         This number is usually considerably greater than the actual number of
  1430.         documents which match the query. 
  1431.         '''
  1432.         return _xapian.MSet_get_matches_upper_bound(*args)
  1433.  
  1434.     
  1435.     def get_max_possible(*args):
  1436.         '''
  1437.         The maximum possible weight in the MSet.
  1438.  
  1439.         Xapian::weight Xapian::MSet::get_max_possible() const
  1440.  
  1441.         This weight is likely not to be attained in the set of results, but
  1442.         represents an upper bound on the weight which a document could attain
  1443.         for the given query. 
  1444.         '''
  1445.         return _xapian.MSet_get_max_possible(*args)
  1446.  
  1447.     
  1448.     def get_max_attained(*args):
  1449.         '''
  1450.         The greatest weight which is attained by any document in the database.
  1451.  
  1452.         Xapian::weight Xapian::MSet::get_max_attained() const
  1453.  
  1454.         If firstitem == 0, this is the weight of the first entry in items.
  1455.  
  1456.         If no documents are found by the query, this will be 0.
  1457.  
  1458.         Note that calculation of max_attained requires calculation of at least
  1459.         one result item - therefore, if no items were requested when the query
  1460.         was performed (by specifying maxitems = 0 in
  1461.         Xapian::Enquire::get_mset()), this value will be 0. 
  1462.         '''
  1463.         return _xapian.MSet_get_max_attained(*args)
  1464.  
  1465.     
  1466.     def size(*args):
  1467.         '''
  1468.         The number of items in this MSet.
  1469.  
  1470.         Xapian::doccount Xapian::MSet::size() const 
  1471.         '''
  1472.         return _xapian.MSet_size(*args)
  1473.  
  1474.     
  1475.     def empty(*args):
  1476.         '''
  1477.         Test if this MSet is empty.
  1478.  
  1479.         bool Xapian::MSet::empty() const 
  1480.         '''
  1481.         return _xapian.MSet_empty(*args)
  1482.  
  1483.     
  1484.     def begin(*args):
  1485.         '''
  1486.         Iterator for the terms in this MSet.
  1487.  
  1488.         MSetIterator Xapian::MSet::begin() const 
  1489.         '''
  1490.         return _xapian.MSet_begin(*args)
  1491.  
  1492.     
  1493.     def end(*args):
  1494.         '''
  1495.         End iterator corresponding to begin().
  1496.  
  1497.         MSetIterator Xapian::MSet::end() const 
  1498.         '''
  1499.         return _xapian.MSet_end(*args)
  1500.  
  1501.     
  1502.     def back(*args):
  1503.         '''
  1504.         Iterator pointing to the last element of this MSet.
  1505.  
  1506.         MSetIterator Xapian::MSet::back() const 
  1507.         '''
  1508.         return _xapian.MSet_back(*args)
  1509.  
  1510.     
  1511.     def get_hit(*args):
  1512.         '''
  1513.         Get an item from the MSet.
  1514.  
  1515.         The supplied index is relative to the start of the MSet, not the absolute rank
  1516.         of the item. 
  1517.         '''
  1518.         return _xapian.MSet_get_hit(*args)
  1519.  
  1520.     
  1521.     def __str__(*args):
  1522.         '''
  1523.         Return a string describing this object.
  1524.  
  1525.         std::string Xapian::MSet::get_description() const 
  1526.         '''
  1527.         return _xapian.MSet___str__(*args)
  1528.  
  1529.     
  1530.     def get_description(*args):
  1531.         '''
  1532.         Return a string describing this object.
  1533.  
  1534.         std::string Xapian::MSet::get_description() const 
  1535.         '''
  1536.         return _xapian.MSet_get_description(*args)
  1537.  
  1538.     items = _swig_property(_xapian.MSet_items_get)
  1539.  
  1540. MSet.fetch = new_instancemethod(_xapian.MSet_fetch, None, MSet)
  1541. MSet.convert_to_percent = new_instancemethod(_xapian.MSet_convert_to_percent, None, MSet)
  1542. MSet.get_termfreq = new_instancemethod(_xapian.MSet_get_termfreq, None, MSet)
  1543. MSet.get_termweight = new_instancemethod(_xapian.MSet_get_termweight, None, MSet)
  1544. MSet.get_firstitem = new_instancemethod(_xapian.MSet_get_firstitem, None, MSet)
  1545. MSet.get_matches_lower_bound = new_instancemethod(_xapian.MSet_get_matches_lower_bound, None, MSet)
  1546. MSet.get_matches_estimated = new_instancemethod(_xapian.MSet_get_matches_estimated, None, MSet)
  1547. MSet.get_matches_upper_bound = new_instancemethod(_xapian.MSet_get_matches_upper_bound, None, MSet)
  1548. MSet.get_max_possible = new_instancemethod(_xapian.MSet_get_max_possible, None, MSet)
  1549. MSet.get_max_attained = new_instancemethod(_xapian.MSet_get_max_attained, None, MSet)
  1550. MSet.size = new_instancemethod(_xapian.MSet_size, None, MSet)
  1551. MSet.empty = new_instancemethod(_xapian.MSet_empty, None, MSet)
  1552. MSet.begin = new_instancemethod(_xapian.MSet_begin, None, MSet)
  1553. MSet.end = new_instancemethod(_xapian.MSet_end, None, MSet)
  1554. MSet.back = new_instancemethod(_xapian.MSet_back, None, MSet)
  1555. MSet.get_hit = new_instancemethod(_xapian.MSet_get_hit, None, MSet)
  1556. MSet.get_document_percentage = new_instancemethod(_xapian.MSet_get_document_percentage, None, MSet)
  1557. MSet.get_document = new_instancemethod(_xapian.MSet_get_document, None, MSet)
  1558. MSet.get_docid = new_instancemethod(_xapian.MSet_get_docid, None, MSet)
  1559. MSet.get_document_id = new_instancemethod(_xapian.MSet_get_document_id, None, MSet)
  1560. MSet.__str__ = new_instancemethod(_xapian.MSet___str__, None, MSet)
  1561. MSet.get_description = new_instancemethod(_xapian.MSet_get_description, None, MSet)
  1562. MSet.__cmp__ = new_instancemethod(_xapian.MSet___cmp__, None, MSet)
  1563. MSet_swigregister = _xapian.MSet_swigregister
  1564. MSet_swigregister(MSet)
  1565.  
  1566. class MSetIterator(object):
  1567.     '''
  1568.     An iterator pointing to items in an MSet.
  1569.  
  1570.     This is used for access to individual results of a match. 
  1571.     '''
  1572.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  1573.     __repr__ = _swig_repr
  1574.     
  1575.     def __init__(self, *args):
  1576.         '''
  1577.         Copying is allowed (and is cheap).
  1578.  
  1579.         Xapian::MSetIterator::MSetIterator(const MSetIterator &other) 
  1580.         '''
  1581.         _xapian.MSetIterator_swiginit(self, _xapian.new_MSetIterator(*args))
  1582.  
  1583.     __swig_destroy__ = _xapian.delete_MSetIterator
  1584.     
  1585.     def get_document(*args):
  1586.         '''
  1587.         Get a Xapian::Document object for the current position.
  1588.  
  1589.         Xapian::Document Xapian::MSetIterator::get_document() const
  1590.  
  1591.         This method returns a Xapian::Document object which provides the
  1592.         information about the document pointed to by the MSetIterator.
  1593.  
  1594.         If the underlying database has suitable support, using this call
  1595.         (rather than asking the database for a document based on its document
  1596.         ID) will enable the system to ensure that the correct data is
  1597.         returned, and that the document has not been deleted or changed since
  1598.         the query was performed.
  1599.  
  1600.         A Xapian::Document object containing the document data.
  1601.  
  1602.         Parameters:
  1603.         -----------
  1604.  
  1605.         Xapian::DocNotFoundError:  The document specified could not be found
  1606.         in the database. 
  1607.         '''
  1608.         return _xapian.MSetIterator_get_document(*args)
  1609.  
  1610.     
  1611.     def get_rank(*args):
  1612.         '''
  1613.         Get the rank of the document at the current position.
  1614.  
  1615.         Xapian::doccount Xapian::MSetIterator::get_rank() const
  1616.  
  1617.         The rank is the position that this document is at in the ordered list
  1618.         of results of the query. The result is 0-based - i.e. the top-ranked
  1619.         document has a rank of 0. 
  1620.         '''
  1621.         return _xapian.MSetIterator_get_rank(*args)
  1622.  
  1623.     
  1624.     def get_weight(*args):
  1625.         '''
  1626.         Get the weight of the document at the current position.
  1627.  
  1628.         Xapian::weight Xapian::MSetIterator::get_weight() const 
  1629.         '''
  1630.         return _xapian.MSetIterator_get_weight(*args)
  1631.  
  1632.     
  1633.     def get_collapse_key(*args):
  1634.         '''
  1635.         Get the collapse key for this document.
  1636.  
  1637.         std::string Xapian::MSetIterator::get_collapse_key() const 
  1638.         '''
  1639.         return _xapian.MSetIterator_get_collapse_key(*args)
  1640.  
  1641.     
  1642.     def get_collapse_count(*args):
  1643.         '''
  1644.         Get an estimate of the number of documents that have been collapsed
  1645.         into this one.
  1646.  
  1647.         Xapian::doccount Xapian::MSetIterator::get_collapse_count() const
  1648.  
  1649.         The estimate will always be less than or equal to the actual number of
  1650.         other documents satisfying the match criteria with the same collapse
  1651.         key as this document.
  1652.  
  1653.         This method may return 0 even though there are other documents with
  1654.         the same collapse key which satisfying the match criteria. However if
  1655.         this method returns non-zero, there definitely are other such
  1656.         documents. So this method may be used to inform the user that there
  1657.         are "at least N other matches in this group", or to control whether
  1658.         to offer a "show other documents in this group" feature (but note
  1659.         that it may not offer it in every case where it would show other
  1660.         documents). 
  1661.         '''
  1662.         return _xapian.MSetIterator_get_collapse_count(*args)
  1663.  
  1664.     
  1665.     def get_percent(*args):
  1666.         '''
  1667.         This returns the weight of the document as a percentage score.
  1668.  
  1669.         Xapian::percent Xapian::MSetIterator::get_percent() const
  1670.  
  1671.         The return value will be in the range 0 to 100: 0 meaning that the
  1672.         item did not match the query at all. 
  1673.         '''
  1674.         return _xapian.MSetIterator_get_percent(*args)
  1675.  
  1676.     
  1677.     def __str__(*args):
  1678.         '''
  1679.         Return a string describing this object.
  1680.  
  1681.         std::string Xapian::MSetIterator::get_description() const 
  1682.         '''
  1683.         return _xapian.MSetIterator___str__(*args)
  1684.  
  1685.     
  1686.     def get_description(*args):
  1687.         '''
  1688.         Return a string describing this object.
  1689.  
  1690.         std::string Xapian::MSetIterator::get_description() const 
  1691.         '''
  1692.         return _xapian.MSetIterator_get_description(*args)
  1693.  
  1694.  
  1695. MSetIterator.get_docid = new_instancemethod(_xapian.MSetIterator_get_docid, None, MSetIterator)
  1696. MSetIterator.next = new_instancemethod(_xapian.MSetIterator_next, None, MSetIterator)
  1697. MSetIterator.prev = new_instancemethod(_xapian.MSetIterator_prev, None, MSetIterator)
  1698. MSetIterator.equals = new_instancemethod(_xapian.MSetIterator_equals, None, MSetIterator)
  1699. MSetIterator.get_document = new_instancemethod(_xapian.MSetIterator_get_document, None, MSetIterator)
  1700. MSetIterator.get_rank = new_instancemethod(_xapian.MSetIterator_get_rank, None, MSetIterator)
  1701. MSetIterator.get_weight = new_instancemethod(_xapian.MSetIterator_get_weight, None, MSetIterator)
  1702. MSetIterator.get_collapse_key = new_instancemethod(_xapian.MSetIterator_get_collapse_key, None, MSetIterator)
  1703. MSetIterator.get_collapse_count = new_instancemethod(_xapian.MSetIterator_get_collapse_count, None, MSetIterator)
  1704. MSetIterator.get_percent = new_instancemethod(_xapian.MSetIterator_get_percent, None, MSetIterator)
  1705. MSetIterator.__str__ = new_instancemethod(_xapian.MSetIterator___str__, None, MSetIterator)
  1706. MSetIterator.get_description = new_instancemethod(_xapian.MSetIterator_get_description, None, MSetIterator)
  1707. MSetIterator.__eq__ = new_instancemethod(_xapian.MSetIterator___eq__, None, MSetIterator)
  1708. MSetIterator.__ne__ = new_instancemethod(_xapian.MSetIterator___ne__, None, MSetIterator)
  1709. MSetIterator_swigregister = _xapian.MSetIterator_swigregister
  1710. MSetIterator_swigregister(MSetIterator)
  1711.  
  1712. class ESet(object):
  1713.     '''
  1714.     Class representing an ordered set of expand terms (an ESet).
  1715.  
  1716.     This set represents the results of an expand operation, which is
  1717.     performed by Xapian::Enquire::get_eset(). 
  1718.     '''
  1719.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  1720.     __repr__ = _swig_repr
  1721.     
  1722.     def __init__(self, *args):
  1723.         '''
  1724.         Copying is allowed (and is cheap).
  1725.  
  1726.         Xapian::ESet::ESet(const ESet &other) 
  1727.         '''
  1728.         _xapian.ESet_swiginit(self, _xapian.new_ESet(*args))
  1729.  
  1730.     __swig_destroy__ = _xapian.delete_ESet
  1731.     
  1732.     def get_ebound(*args):
  1733.         '''
  1734.         A lower bound on the number of terms which are in the full set of
  1735.         results of the expand.
  1736.  
  1737.         Xapian::termcount Xapian::ESet::get_ebound() const
  1738.  
  1739.         This will be greater than or equal to size() 
  1740.         '''
  1741.         return _xapian.ESet_get_ebound(*args)
  1742.  
  1743.     
  1744.     def size(*args):
  1745.         '''
  1746.         The number of terms in this E-Set.
  1747.  
  1748.         Xapian::termcount Xapian::ESet::size() const 
  1749.         '''
  1750.         return _xapian.ESet_size(*args)
  1751.  
  1752.     
  1753.     def empty(*args):
  1754.         '''
  1755.         Test if this E-Set is empty.
  1756.  
  1757.         bool Xapian::ESet::empty() const 
  1758.         '''
  1759.         return _xapian.ESet_empty(*args)
  1760.  
  1761.     
  1762.     def begin(*args):
  1763.         '''
  1764.         Iterator for the terms in this E-Set.
  1765.  
  1766.         ESetIterator Xapian::ESet::begin() const 
  1767.         '''
  1768.         return _xapian.ESet_begin(*args)
  1769.  
  1770.     
  1771.     def end(*args):
  1772.         '''
  1773.         End iterator corresponding to begin().
  1774.  
  1775.         ESetIterator Xapian::ESet::end() const 
  1776.         '''
  1777.         return _xapian.ESet_end(*args)
  1778.  
  1779.     
  1780.     def back(*args):
  1781.         '''
  1782.         Iterator pointing to the last element of this E-Set.
  1783.  
  1784.         ESetIterator Xapian::ESet::back() const 
  1785.         '''
  1786.         return _xapian.ESet_back(*args)
  1787.  
  1788.     
  1789.     def __str__(*args):
  1790.         '''
  1791.         Return a string describing this object.
  1792.  
  1793.         std::string Xapian::ESet::get_description() const 
  1794.         '''
  1795.         return _xapian.ESet___str__(*args)
  1796.  
  1797.     
  1798.     def get_description(*args):
  1799.         '''
  1800.         Return a string describing this object.
  1801.  
  1802.         std::string Xapian::ESet::get_description() const 
  1803.         '''
  1804.         return _xapian.ESet_get_description(*args)
  1805.  
  1806.     items = _swig_property(_xapian.ESet_items_get)
  1807.  
  1808. ESet.get_ebound = new_instancemethod(_xapian.ESet_get_ebound, None, ESet)
  1809. ESet.size = new_instancemethod(_xapian.ESet_size, None, ESet)
  1810. ESet.empty = new_instancemethod(_xapian.ESet_empty, None, ESet)
  1811. ESet.begin = new_instancemethod(_xapian.ESet_begin, None, ESet)
  1812. ESet.end = new_instancemethod(_xapian.ESet_end, None, ESet)
  1813. ESet.back = new_instancemethod(_xapian.ESet_back, None, ESet)
  1814. ESet.__str__ = new_instancemethod(_xapian.ESet___str__, None, ESet)
  1815. ESet.get_description = new_instancemethod(_xapian.ESet_get_description, None, ESet)
  1816. ESet_swigregister = _xapian.ESet_swigregister
  1817. ESet_swigregister(ESet)
  1818.  
  1819. class ESetIterator(object):
  1820.     '''
  1821.     Iterate through terms in the ESet. 
  1822.     '''
  1823.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  1824.     __repr__ = _swig_repr
  1825.     
  1826.     def __init__(self, *args):
  1827.         '''
  1828.         Copying is allowed (and is cheap).
  1829.  
  1830.         Xapian::ESetIterator::ESetIterator(const ESetIterator &other) 
  1831.         '''
  1832.         _xapian.ESetIterator_swiginit(self, _xapian.new_ESetIterator(*args))
  1833.  
  1834.     __swig_destroy__ = _xapian.delete_ESetIterator
  1835.     
  1836.     def get_weight(*args):
  1837.         '''
  1838.         Get the weight of the term at the current position.
  1839.  
  1840.         Xapian::weight Xapian::ESetIterator::get_weight() const 
  1841.         '''
  1842.         return _xapian.ESetIterator_get_weight(*args)
  1843.  
  1844.     
  1845.     def __str__(*args):
  1846.         '''
  1847.         Return a string describing this object.
  1848.  
  1849.         std::string Xapian::ESetIterator::get_description() const 
  1850.         '''
  1851.         return _xapian.ESetIterator___str__(*args)
  1852.  
  1853.     
  1854.     def get_description(*args):
  1855.         '''
  1856.         Return a string describing this object.
  1857.  
  1858.         std::string Xapian::ESetIterator::get_description() const 
  1859.         '''
  1860.         return _xapian.ESetIterator_get_description(*args)
  1861.  
  1862.  
  1863. ESetIterator.get_termname = new_instancemethod(_xapian.ESetIterator_get_termname, None, ESetIterator)
  1864. ESetIterator.get_term = new_instancemethod(_xapian.ESetIterator_get_term, None, ESetIterator)
  1865. ESetIterator.next = new_instancemethod(_xapian.ESetIterator_next, None, ESetIterator)
  1866. ESetIterator.prev = new_instancemethod(_xapian.ESetIterator_prev, None, ESetIterator)
  1867. ESetIterator.equals = new_instancemethod(_xapian.ESetIterator_equals, None, ESetIterator)
  1868. ESetIterator.get_weight = new_instancemethod(_xapian.ESetIterator_get_weight, None, ESetIterator)
  1869. ESetIterator.__str__ = new_instancemethod(_xapian.ESetIterator___str__, None, ESetIterator)
  1870. ESetIterator.get_description = new_instancemethod(_xapian.ESetIterator_get_description, None, ESetIterator)
  1871. ESetIterator.__eq__ = new_instancemethod(_xapian.ESetIterator___eq__, None, ESetIterator)
  1872. ESetIterator.__ne__ = new_instancemethod(_xapian.ESetIterator___ne__, None, ESetIterator)
  1873. ESetIterator_swigregister = _xapian.ESetIterator_swigregister
  1874. ESetIterator_swigregister(ESetIterator)
  1875.  
  1876. class RSet(object):
  1877.     '''
  1878.     A relevance set (R-Set).
  1879.  
  1880.     This is the set of documents which are marked as relevant, for use in
  1881.     modifying the term weights, and in performing query expansion. 
  1882.     '''
  1883.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  1884.     __repr__ = _swig_repr
  1885.     
  1886.     def __init__(self, *args):
  1887.         '''
  1888.         Default constructor.
  1889.  
  1890.         Xapian::RSet::RSet() 
  1891.         '''
  1892.         _xapian.RSet_swiginit(self, _xapian.new_RSet(*args))
  1893.  
  1894.     __swig_destroy__ = _xapian.delete_RSet
  1895.     
  1896.     def size(*args):
  1897.         '''
  1898.         The number of documents in this R-Set.
  1899.  
  1900.         Xapian::doccount Xapian::RSet::size() const 
  1901.         '''
  1902.         return _xapian.RSet_size(*args)
  1903.  
  1904.     
  1905.     def empty(*args):
  1906.         '''
  1907.         Test if this R-Set is empty.
  1908.  
  1909.         bool Xapian::RSet::empty() const 
  1910.         '''
  1911.         return _xapian.RSet_empty(*args)
  1912.  
  1913.     
  1914.     def add_document(*args):
  1915.         '''
  1916.         Add a document to the relevance set.
  1917.  
  1918.         void Xapian::RSet::add_document(const Xapian::MSetIterator &i) 
  1919.         '''
  1920.         return _xapian.RSet_add_document(*args)
  1921.  
  1922.     
  1923.     def remove_document(*args):
  1924.         '''
  1925.         Remove a document from the relevance set.
  1926.  
  1927.         void Xapian::RSet::remove_document(const Xapian::MSetIterator &i) 
  1928.         '''
  1929.         return _xapian.RSet_remove_document(*args)
  1930.  
  1931.     
  1932.     def contains(*args):
  1933.         '''
  1934.         Test if a given document in the relevance set.
  1935.  
  1936.         bool Xapian::RSet::contains(const Xapian::MSetIterator &i) const 
  1937.         '''
  1938.         return _xapian.RSet_contains(*args)
  1939.  
  1940.     
  1941.     def __str__(*args):
  1942.         '''
  1943.         Return a string describing this object.
  1944.  
  1945.         std::string Xapian::RSet::get_description() const 
  1946.         '''
  1947.         return _xapian.RSet___str__(*args)
  1948.  
  1949.     
  1950.     def get_description(*args):
  1951.         '''
  1952.         Return a string describing this object.
  1953.  
  1954.         std::string Xapian::RSet::get_description() const 
  1955.         '''
  1956.         return _xapian.RSet_get_description(*args)
  1957.  
  1958.  
  1959. RSet.size = new_instancemethod(_xapian.RSet_size, None, RSet)
  1960. RSet.empty = new_instancemethod(_xapian.RSet_empty, None, RSet)
  1961. RSet.add_document = new_instancemethod(_xapian.RSet_add_document, None, RSet)
  1962. RSet.remove_document = new_instancemethod(_xapian.RSet_remove_document, None, RSet)
  1963. RSet.contains = new_instancemethod(_xapian.RSet_contains, None, RSet)
  1964. RSet.__str__ = new_instancemethod(_xapian.RSet___str__, None, RSet)
  1965. RSet.get_description = new_instancemethod(_xapian.RSet_get_description, None, RSet)
  1966. RSet_swigregister = _xapian.RSet_swigregister
  1967. RSet_swigregister(RSet)
  1968.  
  1969. class MatchDecider(object):
  1970.     '''
  1971.     Base class for matcher decision functor. 
  1972.     '''
  1973.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  1974.     __repr__ = _swig_repr
  1975.     __swig_destroy__ = _xapian.delete_MatchDecider
  1976.     
  1977.     def __init__(self, *args):
  1978.         if self.__class__ == MatchDecider:
  1979.             args = (None,) + args
  1980.         else:
  1981.             args = (self,) + args
  1982.         _xapian.MatchDecider_swiginit(self, _xapian.new_MatchDecider(*args))
  1983.  
  1984.     
  1985.     def __disown__(self):
  1986.         self.this.disown()
  1987.         _xapian.disown_MatchDecider(self)
  1988.         return weakref_proxy(self)
  1989.  
  1990.  
  1991. MatchDecider.__call__ = new_instancemethod(_xapian.MatchDecider___call__, None, MatchDecider)
  1992. MatchDecider_swigregister = _xapian.MatchDecider_swigregister
  1993. MatchDecider_swigregister(MatchDecider)
  1994.  
  1995. class ExpandDecider(object):
  1996.     '''
  1997.     Virtual base class for expand decider functor. 
  1998.     '''
  1999.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2000.     __repr__ = _swig_repr
  2001.     __swig_destroy__ = _xapian.delete_ExpandDecider
  2002.     
  2003.     def __init__(self, *args):
  2004.         if self.__class__ == ExpandDecider:
  2005.             args = (None,) + args
  2006.         else:
  2007.             args = (self,) + args
  2008.         _xapian.ExpandDecider_swiginit(self, _xapian.new_ExpandDecider(*args))
  2009.  
  2010.     
  2011.     def __disown__(self):
  2012.         self.this.disown()
  2013.         _xapian.disown_ExpandDecider(self)
  2014.         return weakref_proxy(self)
  2015.  
  2016.  
  2017. ExpandDecider.__call__ = new_instancemethod(_xapian.ExpandDecider___call__, None, ExpandDecider)
  2018. ExpandDecider_swigregister = _xapian.ExpandDecider_swigregister
  2019. ExpandDecider_swigregister(ExpandDecider)
  2020.  
  2021. class Enquire(object):
  2022.     '''
  2023.     This class provides an interface to the information retrieval system
  2024.     for the purpose of searching.
  2025.  
  2026.     Databases are usually opened lazily, so exceptions may not be thrown
  2027.     where you would expect them to be. You should catch Xapian::Error
  2028.     exceptions when calling any method in Xapian::Enquire.
  2029.  
  2030.     Parameters:
  2031.     -----------
  2032.  
  2033.     Xapian::InvalidArgumentError:  will be thrown if an invalid argument
  2034.     is supplied, for example, an unknown database type. 
  2035.     '''
  2036.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2037.     __repr__ = _swig_repr
  2038.     
  2039.     def __init__(self, *args):
  2040.         '''
  2041.         Create a Xapian::Enquire object.
  2042.  
  2043.         Xapian::Enquire::Enquire(const Database &database, ErrorHandler
  2044.         *errorhandler_=0)
  2045.  
  2046.         This specification cannot be changed once the Xapian::Enquire is
  2047.         opened: you must create a new Xapian::Enquire object to access a
  2048.         different database, or set of databases.
  2049.  
  2050.         The database supplied must have been initialised (ie, must not be the
  2051.         result of calling the Database::Database() constructor). If you need
  2052.         to handle a situation where you have no index gracefully, a database
  2053.         created with InMemory::open() can be passed here, which represents a
  2054.         completely empty database.
  2055.  
  2056.         Parameters:
  2057.         -----------
  2058.  
  2059.         database:  Specification of the database or databases to use.
  2060.  
  2061.         errorhandler_:  A pointer to the error handler to use. Ownership of
  2062.         the object pointed to is not assumed by the Xapian::Enquire object -
  2063.         the user should delete the Xapian::ErrorHandler object after the
  2064.         Xapian::Enquire object is deleted. To use no error handler, this
  2065.         parameter should be 0.
  2066.  
  2067.         Parameters:
  2068.         -----------
  2069.  
  2070.         Xapian::InvalidArgumentError:  will be thrown if an initialised
  2071.         Database object is supplied. 
  2072.         '''
  2073.         _xapian.Enquire_swiginit(self, _xapian.new_Enquire(*args))
  2074.  
  2075.     __swig_destroy__ = _xapian.delete_Enquire
  2076.     
  2077.     def set_query(*args):
  2078.         '''
  2079.         Set the query to run.
  2080.  
  2081.         void Xapian::Enquire::set_query(const Xapian::Query &query,
  2082.         Xapian::termcount qlen=0)
  2083.  
  2084.         Parameters:
  2085.         -----------
  2086.  
  2087.         query:  the new query to run.
  2088.  
  2089.         qlen:  the query length to use in weight calculations - by default the
  2090.         sum of the wqf of all terms is used. 
  2091.         '''
  2092.         return _xapian.Enquire_set_query(*args)
  2093.  
  2094.     
  2095.     def get_query(*args):
  2096.         '''
  2097.         Get the query which has been set.
  2098.  
  2099.         const Xapian::Query& Xapian::Enquire::get_query() const
  2100.  
  2101.         This is only valid after set_query() has been called.
  2102.  
  2103.         Parameters:
  2104.         -----------
  2105.  
  2106.         Xapian::InvalidArgumentError:  will be thrown if query has not yet
  2107.         been set. 
  2108.         '''
  2109.         return _xapian.Enquire_get_query(*args)
  2110.  
  2111.     
  2112.     def set_weighting_scheme(*args):
  2113.         '''
  2114.         Set the weighting scheme to use for queries.
  2115.  
  2116.         void Xapian::Enquire::set_weighting_scheme(const Weight &weight_)
  2117.  
  2118.         Parameters:
  2119.         -----------
  2120.  
  2121.         weight_:  the new weighting scheme. If no weighting scheme is
  2122.         specified, the default is BM25 with the default parameters. 
  2123.         '''
  2124.         return _xapian.Enquire_set_weighting_scheme(*args)
  2125.  
  2126.     
  2127.     def set_collapse_key(*args):
  2128.         """
  2129.         Set the collapse key to use for queries.
  2130.  
  2131.         void Xapian::Enquire::set_collapse_key(Xapian::valueno collapse_key)
  2132.  
  2133.         Parameters:
  2134.         -----------
  2135.  
  2136.         collapse_key:  value number to collapse on - at most one MSet entry
  2137.         with each particular value will be returned.
  2138.  
  2139.         The entry returned will be the best entry with that particular value
  2140.         (highest weight or highest sorting key).
  2141.  
  2142.         An example use might be to create a value for each document containing
  2143.         an MD5 hash of the document contents. Then duplicate documents from
  2144.         different sources can be eliminated at search time (it's better to
  2145.         eliminate duplicates at index time, but this may not be always be
  2146.         possible - for example the search may be over more than one Xapian
  2147.         database).
  2148.  
  2149.         Another use is to group matches in a particular category (e.g. you
  2150.         might collapse a mailing list search on the Subject: so that there's
  2151.         only one result per discussion thread). In this case you can use
  2152.         get_collapse_count() to give the user some idea how many other results
  2153.         there are. And if you index the Subject: as a boolean term as well as
  2154.         putting it in a value, you can offer a link to a non-collapsed search
  2155.         restricted to that thread using a boolean filter.
  2156.  
  2157.         (default is Xapian::BAD_VALUENO which means no collapsing). 
  2158.         """
  2159.         return _xapian.Enquire_set_collapse_key(*args)
  2160.  
  2161.     ASCENDING = _xapian.Enquire_ASCENDING
  2162.     DESCENDING = _xapian.Enquire_DESCENDING
  2163.     DONT_CARE = _xapian.Enquire_DONT_CARE
  2164.     
  2165.     def set_docid_order(*args):
  2166.         '''
  2167.         Set the direction in which documents are ordered by document id in the
  2168.         returned MSet.
  2169.  
  2170.         void Xapian::Enquire::set_docid_order(docid_order order)
  2171.  
  2172.         This order only has an effect on documents which would otherwise have
  2173.         equal rank. For a weighted probabilistic match with no sort value,
  2174.         this means documents with equal weight. For a boolean match, with no
  2175.         sort value, this means all documents. And if a sort value is used,
  2176.         this means documents with equal sort value (and also equal weight if
  2177.         ordering on relevance after the sort).
  2178.  
  2179.         Parameters:
  2180.         -----------
  2181.  
  2182.         order:  This can be: Xapian::Enquire::ASCENDING docids sort in
  2183.         ascending order (default)
  2184.  
  2185.         Xapian::Enquire::DESCENDING docids sort in descending order
  2186.  
  2187.         Xapian::Enquire::DONT_CARE docids sort in whatever order is most
  2188.         efficient for the backend
  2189.  
  2190.         Note: If you add documents in strict date order, then a boolean search
  2191.         - i.e. set_weighting_scheme(Xapian::BoolWeight()) - with
  2192.         set_docid_order(Xapian::Enquire::DESCENDING) is a very efficient way
  2193.         to perform "sort by date, newest first". 
  2194.         '''
  2195.         return _xapian.Enquire_set_docid_order(*args)
  2196.  
  2197.     
  2198.     def set_cutoff(*args):
  2199.         """
  2200.         Set the percentage and/or weight cutoffs.
  2201.  
  2202.         void Xapian::Enquire::set_cutoff(Xapian::percent percent_cutoff,
  2203.         Xapian::weight weight_cutoff=0)
  2204.  
  2205.         Parameters:
  2206.         -----------
  2207.  
  2208.         percent_cutoff:  Minimum percentage score for returned documents. If a
  2209.         document has a lower percentage score than this, it will not appear in
  2210.         the MSet. If your intention is to return only matches which contain
  2211.         all the terms in the query, then it's more efficient to use
  2212.         Xapian::Query::OP_AND instead of Xapian::Query::OP_OR in the query
  2213.         than to use set_cutoff(100). (default 0 => no percentage cut-off).
  2214.  
  2215.         weight_cutoff:  Minimum weight for a document to be returned. If a
  2216.         document has a lower score that this, it will not appear in the MSet.
  2217.         It is usually only possible to choose an appropriate weight for cutoff
  2218.         based on the results of a previous run of the same query; this is thus
  2219.         mainly useful for alerting operations. The other potential use is with
  2220.         a user specified weighting scheme. (default 0 => no weight cut-off).
  2221.  
  2222.         """
  2223.         return _xapian.Enquire_set_cutoff(*args)
  2224.  
  2225.     
  2226.     def set_sort_by_relevance(*args):
  2227.         '''
  2228.         Set the sorting to be by relevance only.
  2229.  
  2230.         void Xapian::Enquire::set_sort_by_relevance()
  2231.  
  2232.         This is the default. 
  2233.         '''
  2234.         return _xapian.Enquire_set_sort_by_relevance(*args)
  2235.  
  2236.     
  2237.     def set_sort_by_value(*args):
  2238.         """
  2239.         Set the sorting to be by value only.
  2240.  
  2241.         void Xapian::Enquire::set_sort_by_value(Xapian::valueno sort_key, bool
  2242.         ascending=true)
  2243.  
  2244.         NB sorting of values uses a string comparison, so you'll need to store
  2245.         numbers padded with leading zeros or spaces, or with the number of
  2246.         digits prepended.
  2247.  
  2248.         Parameters:
  2249.         -----------
  2250.  
  2251.         sort_key:  value number to sort on.
  2252.  
  2253.         ascending:  If true, documents values which sort higher by string
  2254.         compare are better. If false, the sort order is reversed. (default
  2255.         true) 
  2256.         """
  2257.         return _xapian.Enquire_set_sort_by_value(*args)
  2258.  
  2259.     
  2260.     def set_sort_by_value_then_relevance(*args):
  2261.         """
  2262.         Set the sorting to be by value, then by relevance for documents with
  2263.         the same value.
  2264.  
  2265.         void Xapian::Enquire::set_sort_by_value_then_relevance(Xapian::valueno
  2266.         sort_key, bool ascending=true)
  2267.  
  2268.         NB sorting of values uses a string comparison, so you'll need to store
  2269.         numbers padded with leading zeros or spaces, or with the number of
  2270.         digits prepended.
  2271.  
  2272.         Parameters:
  2273.         -----------
  2274.  
  2275.         sort_key:  value number to sort on.
  2276.  
  2277.         ascending:  If true, documents values which sort higher by string
  2278.         compare are better. If false, the sort order is reversed. (default
  2279.         true) 
  2280.         """
  2281.         return _xapian.Enquire_set_sort_by_value_then_relevance(*args)
  2282.  
  2283.     
  2284.     def set_sort_by_relevance_then_value(*args):
  2285.         """
  2286.         Set the sorting to be by relevance then value.
  2287.  
  2288.         void Xapian::Enquire::set_sort_by_relevance_then_value(Xapian::valueno
  2289.         sort_key, bool ascending=true)
  2290.  
  2291.         NB sorting of values uses a string comparison, so you'll need to store
  2292.         numbers padded with leading zeros or spaces, or with the number of
  2293.         digits prepended.
  2294.  
  2295.         Note that with the default BM25 weighting scheme parameters, non-
  2296.         identical documents will rarely have the same weight, so this setting
  2297.         will give very similar results to set_sort_by_relevance(). It becomes
  2298.         more useful with particular BM25 parameter settings (e.g.
  2299.         BM25Weight(1,0,1,0,0)) or custom weighting schemes.
  2300.  
  2301.         Parameters:
  2302.         -----------
  2303.  
  2304.         sort_key:  value number to sort on.
  2305.  
  2306.         ascending:  If true, documents values which sort higher by string
  2307.         compare are better. If false, the sort order is reversed. (default
  2308.         true) 
  2309.         """
  2310.         return _xapian.Enquire_set_sort_by_relevance_then_value(*args)
  2311.  
  2312.     
  2313.     def set_sort_by_key(*args):
  2314.         '''
  2315.         Set the sorting to be by key generated from values only.
  2316.  
  2317.         void Xapian::Enquire::set_sort_by_key(Xapian::Sorter *sorter, bool
  2318.         ascending=true)
  2319.  
  2320.         Parameters:
  2321.         -----------
  2322.  
  2323.         sorter:  The functor to use for generating keys.
  2324.  
  2325.         ascending:  If true, documents values which sort higher by string
  2326.         compare are better. If false, the sort order is reversed. (default
  2327.         true) 
  2328.         '''
  2329.         return _xapian.Enquire_set_sort_by_key(*args)
  2330.  
  2331.     
  2332.     def set_sort_by_key_then_relevance(*args):
  2333.         '''
  2334.         Set the sorting to be by keys generated from values, then by relevance
  2335.         for documents with identical keys.
  2336.  
  2337.         void Xapian::Enquire::set_sort_by_key_then_relevance(Xapian::Sorter
  2338.         *sorter, bool ascending=true)
  2339.  
  2340.         Parameters:
  2341.         -----------
  2342.  
  2343.         sorter:  The functor to use for generating keys.
  2344.  
  2345.         ascending:  If true, keys which sort higher by string compare are
  2346.         better. If false, the sort order is reversed. (default true) 
  2347.         '''
  2348.         return _xapian.Enquire_set_sort_by_key_then_relevance(*args)
  2349.  
  2350.     
  2351.     def set_sort_by_relevance_then_key(*args):
  2352.         '''
  2353.         Set the sorting to be by relevance, then by keys generated from
  2354.         values.
  2355.  
  2356.         void Xapian::Enquire::set_sort_by_relevance_then_key(Xapian::Sorter
  2357.         *sorter, bool ascending=true)
  2358.  
  2359.         Note that with the default BM25 weighting scheme parameters, non-
  2360.         identical documents will rarely have the same weight, so this setting
  2361.         will give very similar results to set_sort_by_relevance(). It becomes
  2362.         more useful with particular BM25 parameter settings (e.g.
  2363.         BM25Weight(1,0,1,0,0)) or custom weighting schemes.
  2364.  
  2365.         Parameters:
  2366.         -----------
  2367.  
  2368.         sorter:  The functor to use for generating keys.
  2369.  
  2370.         ascending:  If true, keys which sort higher by string compare are
  2371.         better. If false, the sort order is reversed. (default true) 
  2372.         '''
  2373.         return _xapian.Enquire_set_sort_by_relevance_then_key(*args)
  2374.  
  2375.     INCLUDE_QUERY_TERMS = _xapian.Enquire_INCLUDE_QUERY_TERMS
  2376.     USE_EXACT_TERMFREQ = _xapian.Enquire_USE_EXACT_TERMFREQ
  2377.     
  2378.     def get_mset(*args):
  2379.         '''
  2380.         MSet
  2381.         Xapian::Enquire::get_mset(Xapian::doccount first, Xapian::doccount
  2382.         maxitems, const RSet *omrset, const MatchDecider *mdecider=0) const 
  2383.         '''
  2384.         return _xapian.Enquire_get_mset(*args)
  2385.  
  2386.     
  2387.     def get_eset(*args):
  2388.         '''
  2389.         Get the expand set for the given rset.
  2390.  
  2391.         ESet Xapian::Enquire::get_eset(Xapian::termcount maxitems, const RSet
  2392.         &omrset, const Xapian::ExpandDecider *edecider) const
  2393.  
  2394.         Parameters:
  2395.         -----------
  2396.  
  2397.         maxitems:  the maximum number of items to return.
  2398.  
  2399.         omrset:  the relevance set to use when performing the expand
  2400.         operation.
  2401.  
  2402.         edecider:  a decision functor to use to decide whether a given term
  2403.         should be put in the ESet
  2404.  
  2405.         An ESet object containing the results of the expand.
  2406.  
  2407.         Parameters:
  2408.         -----------
  2409.  
  2410.         Xapian::InvalidArgumentError:  See class documentation. 
  2411.         '''
  2412.         return _xapian.Enquire_get_eset(*args)
  2413.  
  2414.     
  2415.     def get_matching_terms_begin(*args):
  2416.         '''
  2417.         Get terms which match a given document, by match set item.
  2418.  
  2419.         TermIterator Xapian::Enquire::get_matching_terms_begin(const
  2420.         MSetIterator &it) const
  2421.  
  2422.         This method returns the terms in the current query which match the
  2423.         given document.
  2424.  
  2425.         If the underlying database has suitable support, using this call
  2426.         (rather than passing a Xapian::docid) will enable the system to ensure
  2427.         that the correct data is returned, and that the document has not been
  2428.         deleted or changed since the query was performed.
  2429.  
  2430.         Parameters:
  2431.         -----------
  2432.  
  2433.         it:  The iterator for which to retrieve the matching terms.
  2434.  
  2435.         An iterator returning the terms which match the document. The terms
  2436.         will be returned (as far as this makes any sense) in the same order as
  2437.         the terms in the query. Terms will not occur more than once, even if
  2438.         they do in the query.
  2439.  
  2440.         Parameters:
  2441.         -----------
  2442.  
  2443.         Xapian::InvalidArgumentError:  See class documentation.
  2444.  
  2445.         Xapian::DocNotFoundError:  The document specified could not be found
  2446.         in the database. 
  2447.         '''
  2448.         return _xapian.Enquire_get_matching_terms_begin(*args)
  2449.  
  2450.     
  2451.     def get_matching_terms_end(*args):
  2452.         '''
  2453.         End iterator corresponding to get_matching_terms_begin().
  2454.  
  2455.         TermIterator Xapian::Enquire::get_matching_terms_end(const
  2456.         MSetIterator &) const 
  2457.         '''
  2458.         return _xapian.Enquire_get_matching_terms_end(*args)
  2459.  
  2460.     
  2461.     def __str__(*args):
  2462.         '''
  2463.         Return a string describing this object.
  2464.  
  2465.         std::string Xapian::Enquire::get_description() const 
  2466.         '''
  2467.         return _xapian.Enquire___str__(*args)
  2468.  
  2469.     
  2470.     def get_description(*args):
  2471.         '''
  2472.         Return a string describing this object.
  2473.  
  2474.         std::string Xapian::Enquire::get_description() const 
  2475.         '''
  2476.         return _xapian.Enquire_get_description(*args)
  2477.  
  2478.  
  2479. Enquire.set_query = new_instancemethod(_xapian.Enquire_set_query, None, Enquire)
  2480. Enquire.get_query = new_instancemethod(_xapian.Enquire_get_query, None, Enquire)
  2481. Enquire.set_weighting_scheme = new_instancemethod(_xapian.Enquire_set_weighting_scheme, None, Enquire)
  2482. Enquire.set_collapse_key = new_instancemethod(_xapian.Enquire_set_collapse_key, None, Enquire)
  2483. Enquire.set_docid_order = new_instancemethod(_xapian.Enquire_set_docid_order, None, Enquire)
  2484. Enquire.set_cutoff = new_instancemethod(_xapian.Enquire_set_cutoff, None, Enquire)
  2485. Enquire.set_sort_by_relevance = new_instancemethod(_xapian.Enquire_set_sort_by_relevance, None, Enquire)
  2486. Enquire.set_sort_by_value = new_instancemethod(_xapian.Enquire_set_sort_by_value, None, Enquire)
  2487. Enquire.set_sort_by_value_then_relevance = new_instancemethod(_xapian.Enquire_set_sort_by_value_then_relevance, None, Enquire)
  2488. Enquire.set_sort_by_relevance_then_value = new_instancemethod(_xapian.Enquire_set_sort_by_relevance_then_value, None, Enquire)
  2489. Enquire.set_sort_by_key = new_instancemethod(_xapian.Enquire_set_sort_by_key, None, Enquire)
  2490. Enquire.set_sort_by_key_then_relevance = new_instancemethod(_xapian.Enquire_set_sort_by_key_then_relevance, None, Enquire)
  2491. Enquire.set_sort_by_relevance_then_key = new_instancemethod(_xapian.Enquire_set_sort_by_relevance_then_key, None, Enquire)
  2492. Enquire.get_mset = new_instancemethod(_xapian.Enquire_get_mset, None, Enquire)
  2493. Enquire.get_eset = new_instancemethod(_xapian.Enquire_get_eset, None, Enquire)
  2494. Enquire.get_matching_terms_begin = new_instancemethod(_xapian.Enquire_get_matching_terms_begin, None, Enquire)
  2495. Enquire.get_matching_terms_end = new_instancemethod(_xapian.Enquire_get_matching_terms_end, None, Enquire)
  2496. Enquire.register_match_decider = new_instancemethod(_xapian.Enquire_register_match_decider, None, Enquire)
  2497. Enquire.get_matching_terms = new_instancemethod(_xapian.Enquire_get_matching_terms, None, Enquire)
  2498. Enquire.__str__ = new_instancemethod(_xapian.Enquire___str__, None, Enquire)
  2499. Enquire.get_description = new_instancemethod(_xapian.Enquire_get_description, None, Enquire)
  2500. Enquire_swigregister = _xapian.Enquire_swigregister
  2501. Enquire_swigregister(Enquire)
  2502.  
  2503. class Weight(object):
  2504.     '''
  2505.     Abstract base class for weighting schemes. 
  2506.     '''
  2507.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2508.     
  2509.     def __init__(self):
  2510.         raise AttributeError, 'No constructor defined'
  2511.  
  2512.     __repr__ = _swig_repr
  2513.     __swig_destroy__ = _xapian.delete_Weight
  2514.     
  2515.     def name(*args):
  2516.         '''
  2517.         Name of the weighting scheme.
  2518.  
  2519.         virtual std::string Xapian::Weight::name() const=0
  2520.  
  2521.         If the subclass is called FooWeight, this should return "Foo". 
  2522.         '''
  2523.         return _xapian.Weight_name(*args)
  2524.  
  2525.     
  2526.     def serialise(*args):
  2527.         '''
  2528.         Serialise object parameters into a string.
  2529.  
  2530.         virtual std::string Xapian::Weight::serialise() const=0 
  2531.         '''
  2532.         return _xapian.Weight_serialise(*args)
  2533.  
  2534.     
  2535.     def unserialise(*args):
  2536.         '''
  2537.         Create object given string serialisation returned by serialise().
  2538.  
  2539.         virtual Weight* Xapian::Weight::unserialise(const std::string &s)
  2540.         const=0 
  2541.         '''
  2542.         return _xapian.Weight_unserialise(*args)
  2543.  
  2544.     
  2545.     def get_sumpart(*args):
  2546.         '''
  2547.         Get a weight which is part of the sum over terms being performed.
  2548.  
  2549.         virtual Xapian::weight Xapian::Weight::get_sumpart(Xapian::termcount
  2550.         wdf, Xapian::doclength len) const=0
  2551.  
  2552.         This returns a weight for a given term and document. These weights are
  2553.         summed to give a total weight for the document.
  2554.  
  2555.         Parameters:
  2556.         -----------
  2557.  
  2558.         wdf:  the within document frequency of the term.
  2559.  
  2560.         len:  the (unnormalised) document length. 
  2561.         '''
  2562.         return _xapian.Weight_get_sumpart(*args)
  2563.  
  2564.     
  2565.     def get_maxpart(*args):
  2566.         '''
  2567.         Gets the maximum value that get_sumpart() may return.
  2568.  
  2569.         virtual Xapian::weight Xapian::Weight::get_maxpart() const=0
  2570.  
  2571.         This is used in optimising searches, by having the postlist tree decay
  2572.         appropriately when parts of it can have limited, or no, further
  2573.         effect. 
  2574.         '''
  2575.         return _xapian.Weight_get_maxpart(*args)
  2576.  
  2577.     
  2578.     def get_sumextra(*args):
  2579.         '''
  2580.         Get an extra weight for a document to add to the sum calculated over
  2581.         the query terms.
  2582.  
  2583.         virtual Xapian::weight Xapian::Weight::get_sumextra(Xapian::doclength
  2584.         len) const=0
  2585.  
  2586.         This returns a weight for a given document, and is used by some
  2587.         weighting schemes to account for influence such as document length.
  2588.  
  2589.         Parameters:
  2590.         -----------
  2591.  
  2592.         len:  the (unnormalised) document length. 
  2593.         '''
  2594.         return _xapian.Weight_get_sumextra(*args)
  2595.  
  2596.     
  2597.     def get_maxextra(*args):
  2598.         '''
  2599.         Gets the maximum value that get_sumextra() may return.
  2600.  
  2601.         virtual Xapian::weight Xapian::Weight::get_maxextra() const=0
  2602.  
  2603.         This is used in optimising searches. 
  2604.         '''
  2605.         return _xapian.Weight_get_maxextra(*args)
  2606.  
  2607.     
  2608.     def get_sumpart_needs_doclength(*args):
  2609.         """
  2610.         return false if the weight object doesn't need doclength
  2611.  
  2612.         virtual bool Xapian::Weight::get_sumpart_needs_doclength() const 
  2613.         """
  2614.         return _xapian.Weight_get_sumpart_needs_doclength(*args)
  2615.  
  2616.  
  2617. Weight.name = new_instancemethod(_xapian.Weight_name, None, Weight)
  2618. Weight.serialise = new_instancemethod(_xapian.Weight_serialise, None, Weight)
  2619. Weight.unserialise = new_instancemethod(_xapian.Weight_unserialise, None, Weight)
  2620. Weight.get_sumpart = new_instancemethod(_xapian.Weight_get_sumpart, None, Weight)
  2621. Weight.get_maxpart = new_instancemethod(_xapian.Weight_get_maxpart, None, Weight)
  2622. Weight.get_sumextra = new_instancemethod(_xapian.Weight_get_sumextra, None, Weight)
  2623. Weight.get_maxextra = new_instancemethod(_xapian.Weight_get_maxextra, None, Weight)
  2624. Weight.get_sumpart_needs_doclength = new_instancemethod(_xapian.Weight_get_sumpart_needs_doclength, None, Weight)
  2625. Weight_swigregister = _xapian.Weight_swigregister
  2626. Weight_swigregister(Weight)
  2627.  
  2628. class BoolWeight(Weight):
  2629.     '''
  2630.     Boolean weighting scheme (everything gets 0). 
  2631.     '''
  2632.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2633.     __repr__ = _swig_repr
  2634.     
  2635.     def clone(*args):
  2636.         '''
  2637.         Return a new weight object of this type.
  2638.  
  2639.         BoolWeight* Xapian::BoolWeight::clone() const
  2640.  
  2641.         A subclass called FooWeight taking parameters param1 and param2 should
  2642.         implement this as:
  2643.  
  2644.         virtual FooWeight * clone() const { return new FooWeight(param1,
  2645.         param2); } 
  2646.         '''
  2647.         return _xapian.BoolWeight_clone(*args)
  2648.  
  2649.     
  2650.     def __init__(self, *args):
  2651.         '''Xapian::BoolWeight::BoolWeight() '''
  2652.         _xapian.BoolWeight_swiginit(self, _xapian.new_BoolWeight(*args))
  2653.  
  2654.     __swig_destroy__ = _xapian.delete_BoolWeight
  2655.     
  2656.     def unserialise(*args):
  2657.         '''
  2658.         Create object given string serialisation returned by serialise().
  2659.  
  2660.         BoolWeight* Xapian::BoolWeight::unserialise(const std::string &s)
  2661.         const 
  2662.         '''
  2663.         return _xapian.BoolWeight_unserialise(*args)
  2664.  
  2665.  
  2666. BoolWeight.clone = new_instancemethod(_xapian.BoolWeight_clone, None, BoolWeight)
  2667. BoolWeight.unserialise = new_instancemethod(_xapian.BoolWeight_unserialise, None, BoolWeight)
  2668. BoolWeight_swigregister = _xapian.BoolWeight_swigregister
  2669. BoolWeight_swigregister(BoolWeight)
  2670.  
  2671. class BM25Weight(Weight):
  2672.     '''
  2673.     BM25 weighting scheme.
  2674.  
  2675.     BM25 weighting options : The BM25 formula is \\[
  2676.     \\frac{k_{2}.n_{q}}{1+L_{d}}+\\sum_{t}\\frac{(k_{3}+1)q_{t
  2677.     }}{k_{3}+q_{t}}.\\frac{(k_{1}+1)f_{t,d}}{k_{1}((1-b)+bL_{d})+f_{t,d}
  2678.     }.w_{t} \\] where  $w_{t}$ is the termweight of term t
  2679.  
  2680.     $f_{t,d}$ is the within document frequency of term t in document d
  2681.  
  2682.     $q_{t}$ is the within query frequency of term t
  2683.  
  2684.     $L_{d}$ is the normalised length of document d
  2685.  
  2686.     $n_{q}$ is the size of the query
  2687.  
  2688.     $k_{1}$, $k_{2}$, $k_{3}$ and $b$ are user specified parameters 
  2689.     '''
  2690.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2691.     __repr__ = _swig_repr
  2692.     
  2693.     def __init__(self, *args):
  2694.         '''Xapian::BM25Weight::BM25Weight() '''
  2695.         _xapian.BM25Weight_swiginit(self, _xapian.new_BM25Weight(*args))
  2696.  
  2697.     
  2698.     def clone(*args):
  2699.         '''
  2700.         Return a new weight object of this type.
  2701.  
  2702.         BM25Weight* Xapian::BM25Weight::clone() const
  2703.  
  2704.         A subclass called FooWeight taking parameters param1 and param2 should
  2705.         implement this as:
  2706.  
  2707.         virtual FooWeight * clone() const { return new FooWeight(param1,
  2708.         param2); } 
  2709.         '''
  2710.         return _xapian.BM25Weight_clone(*args)
  2711.  
  2712.     __swig_destroy__ = _xapian.delete_BM25Weight
  2713.     
  2714.     def unserialise(*args):
  2715.         '''
  2716.         Create object given string serialisation returned by serialise().
  2717.  
  2718.         BM25Weight* Xapian::BM25Weight::unserialise(const std::string &s)
  2719.         const 
  2720.         '''
  2721.         return _xapian.BM25Weight_unserialise(*args)
  2722.  
  2723.  
  2724. BM25Weight.clone = new_instancemethod(_xapian.BM25Weight_clone, None, BM25Weight)
  2725. BM25Weight.unserialise = new_instancemethod(_xapian.BM25Weight_unserialise, None, BM25Weight)
  2726. BM25Weight_swigregister = _xapian.BM25Weight_swigregister
  2727. BM25Weight_swigregister(BM25Weight)
  2728.  
  2729. class TradWeight(Weight):
  2730.     '''
  2731.     Traditional probabilistic weighting scheme.
  2732.  
  2733.     This class implements the Traditional Probabilistic Weighting scheme,
  2734.     as described by the early papers on Probabilistic Retrieval. BM25
  2735.     generally gives better results.
  2736.  
  2737.     The Traditional weighting scheme formula is \\[
  2738.     \\sum_{t}\\frac{f_{t,d}}{k.L_{d}+f_{t,d}}.w_{t} \\] where
  2739.     $w_{t}$ is the termweight of term t
  2740.  
  2741.     $f_{t,d}$ is the within document frequency of term t in document d
  2742.  
  2743.     $L_{d}$ is the normalised length of document d
  2744.  
  2745.     $k$ is a user specifiable parameter
  2746.  
  2747.     TradWeight(k) is equivalent to BM25Weight(k, 0, 0, 1, 0), except that
  2748.     the latter returns weights (k+1) times larger. 
  2749.     '''
  2750.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2751.     __repr__ = _swig_repr
  2752.     
  2753.     def __init__(self, *args):
  2754.         '''Xapian::TradWeight::TradWeight() '''
  2755.         _xapian.TradWeight_swiginit(self, _xapian.new_TradWeight(*args))
  2756.  
  2757.     
  2758.     def clone(*args):
  2759.         '''
  2760.         Return a new weight object of this type.
  2761.  
  2762.         TradWeight* Xapian::TradWeight::clone() const
  2763.  
  2764.         A subclass called FooWeight taking parameters param1 and param2 should
  2765.         implement this as:
  2766.  
  2767.         virtual FooWeight * clone() const { return new FooWeight(param1,
  2768.         param2); } 
  2769.         '''
  2770.         return _xapian.TradWeight_clone(*args)
  2771.  
  2772.     __swig_destroy__ = _xapian.delete_TradWeight
  2773.     
  2774.     def unserialise(*args):
  2775.         '''
  2776.         Create object given string serialisation returned by serialise().
  2777.  
  2778.         TradWeight* Xapian::TradWeight::unserialise(const std::string &s)
  2779.         const 
  2780.         '''
  2781.         return _xapian.TradWeight_unserialise(*args)
  2782.  
  2783.  
  2784. TradWeight.clone = new_instancemethod(_xapian.TradWeight_clone, None, TradWeight)
  2785. TradWeight.unserialise = new_instancemethod(_xapian.TradWeight_unserialise, None, TradWeight)
  2786. TradWeight_swigregister = _xapian.TradWeight_swigregister
  2787. TradWeight_swigregister(TradWeight)
  2788.  
  2789. class Database(object):
  2790.     '''
  2791.     This class is used to access a database, or a group of databases.
  2792.  
  2793.     For searching, this class is used in conjunction with an Enquire
  2794.     object.
  2795.  
  2796.     Parameters:
  2797.     -----------
  2798.  
  2799.     InvalidArgumentError:  will be thrown if an invalid argument is
  2800.     supplied, for example, an unknown database type.
  2801.  
  2802.     DatabaseOpeningError:  may be thrown if the database cannot be opened
  2803.     (for example, a required file cannot be found).
  2804.  
  2805.     DatabaseVersionError:  may be thrown if the database is in an
  2806.     unsupported format (for example, created by a newer version of Xapian
  2807.     which uses an incompatible format). 
  2808.     '''
  2809.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2810.     __repr__ = _swig_repr
  2811.     
  2812.     def add_database(*args):
  2813.         '''
  2814.         Add an existing database (or group of databases) to those accessed by
  2815.         this object.
  2816.  
  2817.         void Xapian::Database::add_database(const Database &database)
  2818.  
  2819.         Parameters:
  2820.         -----------
  2821.  
  2822.         database:  the database(s) to add. 
  2823.         '''
  2824.         return _xapian.Database_add_database(*args)
  2825.  
  2826.     __swig_destroy__ = _xapian.delete_Database
  2827.     
  2828.     def __init__(self, *args):
  2829.         '''
  2830.         Copying is allowed.
  2831.  
  2832.         Xapian::Database::Database(const Database &other)
  2833.  
  2834.         The internals are reference counted, so copying is cheap. 
  2835.         '''
  2836.         _xapian.Database_swiginit(self, _xapian.new_Database(*args))
  2837.  
  2838.     
  2839.     def reopen(*args):
  2840.         '''
  2841.         Re-open the database.
  2842.  
  2843.         void Xapian::Database::reopen()
  2844.  
  2845.         This re-opens the database(s) to the latest available version(s). It
  2846.         can be used either to make sure the latest results are returned, or to
  2847.         recover from a Xapian::DatabaseModifiedError. 
  2848.         '''
  2849.         return _xapian.Database_reopen(*args)
  2850.  
  2851.     
  2852.     def __str__(*args):
  2853.         '''
  2854.         Return a string describing this object.
  2855.  
  2856.         virtual std::string Xapian::Database::get_description() const 
  2857.         '''
  2858.         return _xapian.Database___str__(*args)
  2859.  
  2860.     
  2861.     def postlist_begin(*args):
  2862.         '''
  2863.         An iterator pointing to the start of the postlist for a given term.
  2864.  
  2865.         PostingIterator Xapian::Database::postlist_begin(const std::string
  2866.         &tname) const
  2867.  
  2868.         If the term name is the empty string, the iterator returned will list
  2869.         all the documents in the database. Such an iterator will always return
  2870.         a WDF value of 1, since there is no obvious meaning for this quantity
  2871.         in this case. 
  2872.         '''
  2873.         return _xapian.Database_postlist_begin(*args)
  2874.  
  2875.     
  2876.     def postlist_end(*args):
  2877.         '''
  2878.         Corresponding end iterator to postlist_begin().
  2879.  
  2880.         PostingIterator Xapian::Database::postlist_end(const std::string &)
  2881.         const 
  2882.         '''
  2883.         return _xapian.Database_postlist_end(*args)
  2884.  
  2885.     
  2886.     def termlist_begin(*args):
  2887.         '''
  2888.         An iterator pointing to the start of the termlist for a given
  2889.         document.
  2890.  
  2891.         TermIterator Xapian::Database::termlist_begin(Xapian::docid did) const
  2892.  
  2893.         '''
  2894.         return _xapian.Database_termlist_begin(*args)
  2895.  
  2896.     
  2897.     def termlist_end(*args):
  2898.         '''
  2899.         Corresponding end iterator to termlist_begin().
  2900.  
  2901.         TermIterator Xapian::Database::termlist_end(Xapian::docid) const 
  2902.         '''
  2903.         return _xapian.Database_termlist_end(*args)
  2904.  
  2905.     
  2906.     def positionlist_begin(*args):
  2907.         '''
  2908.         An iterator pointing to the start of the position list for a given
  2909.         term in a given document.
  2910.  
  2911.         PositionIterator Xapian::Database::positionlist_begin(Xapian::docid
  2912.         did, const std::string &tname) const 
  2913.         '''
  2914.         return _xapian.Database_positionlist_begin(*args)
  2915.  
  2916.     
  2917.     def positionlist_end(*args):
  2918.         '''
  2919.         Corresponding end iterator to positionlist_begin().
  2920.  
  2921.         PositionIterator Xapian::Database::positionlist_end(Xapian::docid,
  2922.         const std::string &) const 
  2923.         '''
  2924.         return _xapian.Database_positionlist_end(*args)
  2925.  
  2926.     
  2927.     def allterms_begin(*args):
  2928.         '''
  2929.         An iterator which runs across all terms with a given prefix.
  2930.  
  2931.         TermIterator Xapian::Database::allterms_begin(const std::string
  2932.         &prefix) const
  2933.  
  2934.         This is functionally similar to getting an iterator with
  2935.         allterms_begin() and then calling skip_to(prefix) on that iterator to
  2936.         move to the start of the prefix, but is more convenient (because it
  2937.         detects the end of the prefixed terms), and may be more efficient than
  2938.         simply calling skip_to() after opening the iterator, particularly for
  2939.         network databases.
  2940.  
  2941.         Parameters:
  2942.         -----------
  2943.  
  2944.         prefix:  The prefix to restrict the returned terms to. 
  2945.         '''
  2946.         return _xapian.Database_allterms_begin(*args)
  2947.  
  2948.     
  2949.     def allterms_end(*args):
  2950.         '''
  2951.         Corresponding end iterator to allterms_begin(prefix).
  2952.  
  2953.         TermIterator Xapian::Database::allterms_end(const std::string &) const
  2954.  
  2955.         '''
  2956.         return _xapian.Database_allterms_end(*args)
  2957.  
  2958.     
  2959.     def get_doccount(*args):
  2960.         '''
  2961.         Get the number of documents in the database.
  2962.  
  2963.         Xapian::doccount Xapian::Database::get_doccount() const 
  2964.         '''
  2965.         return _xapian.Database_get_doccount(*args)
  2966.  
  2967.     
  2968.     def get_lastdocid(*args):
  2969.         '''
  2970.         Get the highest document id which has been used in the database.
  2971.  
  2972.         Xapian::docid Xapian::Database::get_lastdocid() const 
  2973.         '''
  2974.         return _xapian.Database_get_lastdocid(*args)
  2975.  
  2976.     
  2977.     def get_avlength(*args):
  2978.         '''
  2979.         Get the average length of the documents in the database.
  2980.  
  2981.         Xapian::doclength Xapian::Database::get_avlength() const 
  2982.         '''
  2983.         return _xapian.Database_get_avlength(*args)
  2984.  
  2985.     
  2986.     def get_termfreq(*args):
  2987.         '''
  2988.         Get the number of documents in the database indexed by a given term.
  2989.  
  2990.         Xapian::doccount Xapian::Database::get_termfreq(const std::string
  2991.         &tname) const 
  2992.         '''
  2993.         return _xapian.Database_get_termfreq(*args)
  2994.  
  2995.     
  2996.     def term_exists(*args):
  2997.         '''
  2998.         Check if a given term exists in the database.
  2999.  
  3000.         bool Xapian::Database::term_exists(const std::string &tname) const
  3001.  
  3002.         Return true if and only if the term exists in the database. This is
  3003.         the same as (get_termfreq(tname) != 0), but will often be more
  3004.         efficient. 
  3005.         '''
  3006.         return _xapian.Database_term_exists(*args)
  3007.  
  3008.     
  3009.     def get_collection_freq(*args):
  3010.         '''
  3011.         Return the total number of occurrences of the given term.
  3012.  
  3013.         Xapian::termcount Xapian::Database::get_collection_freq(const
  3014.         std::string &tname) const
  3015.  
  3016.         This is the sum of the number of occurrences of the term in each
  3017.         document it indexes: i.e., the sum of the within document frequencies
  3018.         of the term.
  3019.  
  3020.         Parameters:
  3021.         -----------
  3022.  
  3023.         tname:  The term whose collection frequency is being requested. 
  3024.         '''
  3025.         return _xapian.Database_get_collection_freq(*args)
  3026.  
  3027.     
  3028.     def get_doclength(*args):
  3029.         '''
  3030.         Get the length of a document.
  3031.  
  3032.         Xapian::doclength Xapian::Database::get_doclength(Xapian::docid did)
  3033.         const 
  3034.         '''
  3035.         return _xapian.Database_get_doclength(*args)
  3036.  
  3037.     
  3038.     def keep_alive(*args):
  3039.         '''
  3040.         Send a "keep-alive" to remote databases to stop them timing out.
  3041.  
  3042.         void Xapian::Database::keep_alive() 
  3043.         '''
  3044.         return _xapian.Database_keep_alive(*args)
  3045.  
  3046.     
  3047.     def get_document(*args):
  3048.         '''
  3049.         Get a document from the database, given its document id.
  3050.  
  3051.         Xapian::Document Xapian::Database::get_document(Xapian::docid did)
  3052.         const
  3053.  
  3054.         This method returns a Xapian::Document object which provides the
  3055.         information about a document.
  3056.  
  3057.         Parameters:
  3058.         -----------
  3059.  
  3060.         did:  The document id for which to retrieve the data.
  3061.  
  3062.         A Xapian::Document object containing the document data
  3063.  
  3064.         Parameters:
  3065.         -----------
  3066.  
  3067.         Xapian::DocNotFoundError:  The document specified could not be found
  3068.         in the database. 
  3069.         '''
  3070.         return _xapian.Database_get_document(*args)
  3071.  
  3072.     
  3073.     def get_spelling_suggestion(*args):
  3074.         '''
  3075.         Suggest a spelling correction.
  3076.  
  3077.         std::string Xapian::Database::get_spelling_suggestion(const
  3078.         std::string &word, unsigned max_edit_distance=2) const
  3079.  
  3080.         Parameters:
  3081.         -----------
  3082.  
  3083.         word:  The potentially misspelled word.
  3084.  
  3085.         max_edit_distance:  Only consider words which are at most
  3086.         max_edit_distance edits from word. An edit is a character insertion,
  3087.         deletion, or the transposition of two adjacent characters (default is
  3088.         2). 
  3089.         '''
  3090.         return _xapian.Database_get_spelling_suggestion(*args)
  3091.  
  3092.     
  3093.     def spellings_begin(*args):
  3094.         '''
  3095.         An iterator which returns all the spelling correction targets.
  3096.  
  3097.         Xapian::TermIterator Xapian::Database::spellings_begin() const
  3098.  
  3099.         This returns all the words which are considered as targets for the
  3100.         spelling correction algorithm. The frequency of each word is available
  3101.         as the term frequency of each entry in the returned iterator. 
  3102.         '''
  3103.         return _xapian.Database_spellings_begin(*args)
  3104.  
  3105.     
  3106.     def spellings_end(*args):
  3107.         '''
  3108.         Corresponding end iterator to spellings_begin().
  3109.  
  3110.         Xapian::TermIterator Xapian::Database::spellings_end() const 
  3111.         '''
  3112.         return _xapian.Database_spellings_end(*args)
  3113.  
  3114.     
  3115.     def synonyms_begin(*args):
  3116.         '''
  3117.         An iterator which returns all the synonyms for a given term.
  3118.  
  3119.         Xapian::TermIterator Xapian::Database::synonyms_begin(const
  3120.         std::string &term) const
  3121.  
  3122.         Parameters:
  3123.         -----------
  3124.  
  3125.         term:  The term to return synonyms for. 
  3126.         '''
  3127.         return _xapian.Database_synonyms_begin(*args)
  3128.  
  3129.     
  3130.     def synonyms_end(*args):
  3131.         '''
  3132.         Corresponding end iterator to synonyms_begin(term).
  3133.  
  3134.         Xapian::TermIterator Xapian::Database::synonyms_end(const std::string
  3135.         &) const 
  3136.         '''
  3137.         return _xapian.Database_synonyms_end(*args)
  3138.  
  3139.     
  3140.     def synonym_keys_begin(*args):
  3141.         '''
  3142.         An iterator which returns all terms which have synonyms.
  3143.  
  3144.         Xapian::TermIterator Xapian::Database::synonym_keys_begin(const
  3145.         std::string &prefix="") const
  3146.  
  3147.         Parameters:
  3148.         -----------
  3149.  
  3150.         prefix:  If non-empty, only terms with this prefix are returned. 
  3151.         '''
  3152.         return _xapian.Database_synonym_keys_begin(*args)
  3153.  
  3154.     
  3155.     def synonym_keys_end(*args):
  3156.         '''
  3157.         Corresponding end iterator to synonym_keys_begin(prefix).
  3158.  
  3159.         Xapian::TermIterator Xapian::Database::synonym_keys_end(const
  3160.         std::string &="") const 
  3161.         '''
  3162.         return _xapian.Database_synonym_keys_end(*args)
  3163.  
  3164.     
  3165.     def get_metadata(*args):
  3166.         """
  3167.         Get the user-specified metadata associated with a given key.
  3168.  
  3169.         std::string Xapian::Database::get_metadata(const std::string &key)
  3170.         const
  3171.  
  3172.         User-specified metadata allows you to store arbitrary information in
  3173.         the form of (key,tag) pairs. See  WritableDatabase::set_metadata() for
  3174.         more information.
  3175.  
  3176.         When invoked on a Xapian::Database object representing multiple
  3177.         databases, currently only the metadata for the first is considered but
  3178.         this behaviour may change in the future.
  3179.  
  3180.         If there is no piece of metadata associated with the specified key, an
  3181.         empty string is returned (this applies even for backends which don't
  3182.         support metadata).
  3183.  
  3184.         Empty keys are not valid, and specifying one will cause an exception.
  3185.  
  3186.         Parameters:
  3187.         -----------
  3188.  
  3189.         key:  The key of the metadata item to access.
  3190.  
  3191.         The retrieved metadata item's value.
  3192.  
  3193.         Parameters:
  3194.         -----------
  3195.  
  3196.         Xapian::InvalidArgumentError:  will be thrown if the key supplied is
  3197.         empty.
  3198.  
  3199.         Xapian::UnimplementedError:  will be thrown if the database backend in
  3200.         use doesn't support user- specified metadata. 
  3201.         """
  3202.         return _xapian.Database_get_metadata(*args)
  3203.  
  3204.     
  3205.     def get_description(*args):
  3206.         '''
  3207.         Return a string describing this object.
  3208.  
  3209.         virtual std::string Xapian::Database::get_description() const 
  3210.         '''
  3211.         return _xapian.Database_get_description(*args)
  3212.  
  3213.  
  3214. Database.add_database = new_instancemethod(_xapian.Database_add_database, None, Database)
  3215. Database.reopen = new_instancemethod(_xapian.Database_reopen, None, Database)
  3216. Database.__str__ = new_instancemethod(_xapian.Database___str__, None, Database)
  3217. Database.postlist_begin = new_instancemethod(_xapian.Database_postlist_begin, None, Database)
  3218. Database.postlist_end = new_instancemethod(_xapian.Database_postlist_end, None, Database)
  3219. Database.termlist_begin = new_instancemethod(_xapian.Database_termlist_begin, None, Database)
  3220. Database.termlist_end = new_instancemethod(_xapian.Database_termlist_end, None, Database)
  3221. Database.positionlist_begin = new_instancemethod(_xapian.Database_positionlist_begin, None, Database)
  3222. Database.positionlist_end = new_instancemethod(_xapian.Database_positionlist_end, None, Database)
  3223. Database.allterms_begin = new_instancemethod(_xapian.Database_allterms_begin, None, Database)
  3224. Database.allterms_end = new_instancemethod(_xapian.Database_allterms_end, None, Database)
  3225. Database.get_doccount = new_instancemethod(_xapian.Database_get_doccount, None, Database)
  3226. Database.get_lastdocid = new_instancemethod(_xapian.Database_get_lastdocid, None, Database)
  3227. Database.get_avlength = new_instancemethod(_xapian.Database_get_avlength, None, Database)
  3228. Database.get_termfreq = new_instancemethod(_xapian.Database_get_termfreq, None, Database)
  3229. Database.term_exists = new_instancemethod(_xapian.Database_term_exists, None, Database)
  3230. Database.get_collection_freq = new_instancemethod(_xapian.Database_get_collection_freq, None, Database)
  3231. Database.get_doclength = new_instancemethod(_xapian.Database_get_doclength, None, Database)
  3232. Database.keep_alive = new_instancemethod(_xapian.Database_keep_alive, None, Database)
  3233. Database.get_document = new_instancemethod(_xapian.Database_get_document, None, Database)
  3234. Database.get_spelling_suggestion = new_instancemethod(_xapian.Database_get_spelling_suggestion, None, Database)
  3235. Database.spellings_begin = new_instancemethod(_xapian.Database_spellings_begin, None, Database)
  3236. Database.spellings_end = new_instancemethod(_xapian.Database_spellings_end, None, Database)
  3237. Database.synonyms_begin = new_instancemethod(_xapian.Database_synonyms_begin, None, Database)
  3238. Database.synonyms_end = new_instancemethod(_xapian.Database_synonyms_end, None, Database)
  3239. Database.synonym_keys_begin = new_instancemethod(_xapian.Database_synonym_keys_begin, None, Database)
  3240. Database.synonym_keys_end = new_instancemethod(_xapian.Database_synonym_keys_end, None, Database)
  3241. Database.get_metadata = new_instancemethod(_xapian.Database_get_metadata, None, Database)
  3242. Database.get_description = new_instancemethod(_xapian.Database_get_description, None, Database)
  3243. Database_swigregister = _xapian.Database_swigregister
  3244. Database_swigregister(Database)
  3245.  
  3246. class WritableDatabase(Database):
  3247.     '''
  3248.     This class provides read/write access to a database. 
  3249.     '''
  3250.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  3251.     __repr__ = _swig_repr
  3252.     __swig_destroy__ = _xapian.delete_WritableDatabase
  3253.     
  3254.     def __init__(self, *args):
  3255.         '''
  3256.         Copying is allowed.
  3257.  
  3258.         Xapian::WritableDatabase::WritableDatabase(const WritableDatabase
  3259.         &other)
  3260.  
  3261.         The internals are reference counted, so copying is cheap. 
  3262.         '''
  3263.         _xapian.WritableDatabase_swiginit(self, _xapian.new_WritableDatabase(*args))
  3264.  
  3265.     
  3266.     def flush(*args):
  3267.         """
  3268.         Flush to disk any modifications made to the database.
  3269.  
  3270.         void Xapian::WritableDatabase::flush()
  3271.  
  3272.         For efficiency reasons, when performing multiple updates to a database
  3273.         it is best (indeed, almost essential) to make as many modifications as
  3274.         memory will permit in a single pass through the database. To ensure
  3275.         this, Xapian batches up modifications.
  3276.  
  3277.         Flush may be called at any time to ensure that the modifications which
  3278.         have been made are written to disk: if the flush succeeds, all the
  3279.         preceding modifications will have been written to disk.
  3280.  
  3281.         If any of the modifications fail, an exception will be thrown and the
  3282.         database will be left in a state in which each separate addition,
  3283.         replacement or deletion operation has either been fully performed or
  3284.         not performed at all: it is then up to the application to work out
  3285.         which operations need to be repeated.
  3286.  
  3287.         It's not valid to call flush within a transaction.
  3288.  
  3289.         Beware of calling flush too frequently: this will have a severe
  3290.         performance cost.
  3291.  
  3292.         Note that flush need not be called explicitly: it will be called
  3293.         automatically when the database is closed, or when a sufficient number
  3294.         of modifications have been made.
  3295.  
  3296.         Parameters:
  3297.         -----------
  3298.  
  3299.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3300.         modifying the database.
  3301.  
  3302.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3303.         corrupt state.
  3304.  
  3305.         Xapian::DatabaseLockError:  will be thrown if a lock couldn't be
  3306.         acquired on the database. 
  3307.         """
  3308.         return _xapian.WritableDatabase_flush(*args)
  3309.  
  3310.     
  3311.     def begin_transaction(*args):
  3312.         """
  3313.         Begin a transaction.
  3314.  
  3315.         void Xapian::WritableDatabase::begin_transaction(bool flushed=true)
  3316.  
  3317.         In Xapian a transaction is a group of modifications to the database
  3318.         which are linked such that either all will be applied simultaneously
  3319.         or none will be applied at all. Even in the case of a power failure,
  3320.         this characteristic should be preserved (as long as the filesystem
  3321.         isn't corrupted, etc).
  3322.  
  3323.         A transaction is started with begin_transaction() and can either be
  3324.         committed by calling commit_transaction() or aborted by calling
  3325.         cancel_transaction().
  3326.  
  3327.         By default, a transaction implicitly calls flush before and after so
  3328.         that the modifications stand and fall without affecting modifications
  3329.         before or after.
  3330.  
  3331.         The downside of this flushing is that small transactions cause
  3332.         modifications to be frequently flushed which can harm indexing
  3333.         performance in the same way that explicitly calling flush frequently
  3334.         can.
  3335.  
  3336.         If you're applying atomic groups of changes and only wish to ensure
  3337.         that each group is either applied or not applied, then you can prevent
  3338.         the automatic flush before and after the transaction by starting the
  3339.         transaction with begin_transaction(false). However, if
  3340.         cancel_transaction is called (or if commit_transaction isn't called
  3341.         before the WritableDatabase object is destroyed) then any changes
  3342.         which were pending before the transaction began will also be
  3343.         discarded.
  3344.  
  3345.         Transactions aren't currently supported by the InMemory backend.
  3346.  
  3347.         Parameters:
  3348.         -----------
  3349.  
  3350.         Xapian::UnimplementedError:  will be thrown if transactions are not
  3351.         available for this database type.
  3352.  
  3353.         Xapian::InvalidOperationError:  will be thrown if this is called at an
  3354.         invalid time, such as when a transaction is already in progress. 
  3355.         """
  3356.         return _xapian.WritableDatabase_begin_transaction(*args)
  3357.  
  3358.     
  3359.     def commit_transaction(*args):
  3360.         '''
  3361.         Complete the transaction currently in progress.
  3362.  
  3363.         void Xapian::WritableDatabase::commit_transaction()
  3364.  
  3365.         If this method completes successfully and this is a flushed
  3366.         transaction, all the database modifications made during the
  3367.         transaction will have been committed to the database.
  3368.  
  3369.         If an error occurs, an exception will be thrown, and none of the
  3370.         modifications made to the database during the transaction will have
  3371.         been applied to the database.
  3372.  
  3373.         In all cases the transaction will no longer be in progress.
  3374.  
  3375.         Parameters:
  3376.         -----------
  3377.  
  3378.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3379.         modifying the database.
  3380.  
  3381.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3382.         corrupt state.
  3383.  
  3384.         Xapian::InvalidOperationError:  will be thrown if a transaction is not
  3385.         currently in progress.
  3386.  
  3387.         Xapian::UnimplementedError:  will be thrown if transactions are not
  3388.         available for this database type. 
  3389.         '''
  3390.         return _xapian.WritableDatabase_commit_transaction(*args)
  3391.  
  3392.     
  3393.     def cancel_transaction(*args):
  3394.         '''
  3395.         Abort the transaction currently in progress, discarding the potential
  3396.         modifications made to the database.
  3397.  
  3398.         void Xapian::WritableDatabase::cancel_transaction()
  3399.  
  3400.         If an error occurs in this method, an exception will be thrown, but
  3401.         the transaction will be cancelled anyway.
  3402.  
  3403.         Parameters:
  3404.         -----------
  3405.  
  3406.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3407.         modifying the database.
  3408.  
  3409.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3410.         corrupt state.
  3411.  
  3412.         Xapian::InvalidOperationError:  will be thrown if a transaction is not
  3413.         currently in progress.
  3414.  
  3415.         Xapian::UnimplementedError:  will be thrown if transactions are not
  3416.         available for this database type. 
  3417.         '''
  3418.         return _xapian.WritableDatabase_cancel_transaction(*args)
  3419.  
  3420.     
  3421.     def add_document(*args):
  3422.         """
  3423.         Add a new document to the database.
  3424.  
  3425.         Xapian::docid Xapian::WritableDatabase::add_document(const
  3426.         Xapian::Document &document)
  3427.  
  3428.         This method adds the specified document to the database, returning a
  3429.         newly allocated document ID. Automatically allocated document IDs come
  3430.         from a per-database monotonically increasing counter, so IDs from
  3431.         deleted documents won't be reused.
  3432.  
  3433.         If you want to specify the document ID to be used, you should call
  3434.         replace_document() instead.
  3435.  
  3436.         Note that changes to the database won't be immediately committed to
  3437.         disk; see flush() for more details.
  3438.  
  3439.         As with all database modification operations, the effect is atomic:
  3440.         the document will either be fully added, or the document fails to be
  3441.         added and an exception is thrown (possibly at a later time when flush
  3442.         is called or the database is closed).
  3443.  
  3444.         Parameters:
  3445.         -----------
  3446.  
  3447.         document:  The new document to be added.
  3448.  
  3449.         The document ID of the newly added document.
  3450.  
  3451.         Parameters:
  3452.         -----------
  3453.  
  3454.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3455.         writing to the database.
  3456.  
  3457.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3458.         corrupt state. 
  3459.         """
  3460.         return _xapian.WritableDatabase_add_document(*args)
  3461.  
  3462.     
  3463.     def delete_document(*args):
  3464.         '''
  3465.         Delete any documents indexed by a term from the database.
  3466.  
  3467.         void Xapian::WritableDatabase::delete_document(const std::string
  3468.         &unique_term)
  3469.  
  3470.         This method removes any documents indexed by the specified term from
  3471.         the database.
  3472.  
  3473.         A major use is for convenience when UIDs from another system are
  3474.         mapped to terms in Xapian, although this method has other uses (for
  3475.         example, you could add a "deletion date" term to documents at index
  3476.         time and use this method to delete all documents due for deletion on a
  3477.         particular date).
  3478.  
  3479.         Parameters:
  3480.         -----------
  3481.  
  3482.         unique_term:  The term to remove references to.
  3483.  
  3484.         Parameters:
  3485.         -----------
  3486.  
  3487.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3488.         writing to the database.
  3489.  
  3490.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3491.         corrupt state. 
  3492.         '''
  3493.         return _xapian.WritableDatabase_delete_document(*args)
  3494.  
  3495.     
  3496.     def replace_document(*args):
  3497.         '''
  3498.         Replace any documents matching a term.
  3499.  
  3500.         Xapian::docid Xapian::WritableDatabase::replace_document(const
  3501.         std::string &unique_term, const Xapian::Document &document)
  3502.  
  3503.         This method replaces any documents indexed by the specified term with
  3504.         the specified document. If any documents are indexed by the term, the
  3505.         lowest document ID will be used for the document, otherwise a new
  3506.         document ID will be generated as for add_document.
  3507.  
  3508.         The intended use is to allow UIDs from another system to easily be
  3509.         mapped to terms in Xapian, although this method probably has other
  3510.         uses.
  3511.  
  3512.         Note that changes to the database won\'t be immediately committed to
  3513.         disk; see flush() for more details.
  3514.  
  3515.         As with all database modification operations, the effect is atomic:
  3516.         the document(s) will either be fully replaced, or the document(s) fail
  3517.         to be replaced and an exception is thrown (possibly at a later time
  3518.         when flush is called or the database is closed).
  3519.  
  3520.         Parameters:
  3521.         -----------
  3522.  
  3523.         unique_term:  The "unique" term.
  3524.  
  3525.         document:  The new document.
  3526.  
  3527.         The document ID that document was given.
  3528.  
  3529.         Parameters:
  3530.         -----------
  3531.  
  3532.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3533.         writing to the database.
  3534.  
  3535.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3536.         corrupt state. 
  3537.         '''
  3538.         return _xapian.WritableDatabase_replace_document(*args)
  3539.  
  3540.     
  3541.     def add_spelling(*args):
  3542.         '''
  3543.         Add a word to the spelling dictionary.
  3544.  
  3545.         void Xapian::WritableDatabase::add_spelling(const std::string &word,
  3546.         Xapian::termcount freqinc=1) const
  3547.  
  3548.         If the word is already present, its frequency is increased.
  3549.  
  3550.         Parameters:
  3551.         -----------
  3552.  
  3553.         word:  The word to add.
  3554.  
  3555.         freqinc:  How much to increase its frequency by (default 1). 
  3556.         '''
  3557.         return _xapian.WritableDatabase_add_spelling(*args)
  3558.  
  3559.     
  3560.     def remove_spelling(*args):
  3561.         """
  3562.         Remove a word from the spelling dictionary.
  3563.  
  3564.         void Xapian::WritableDatabase::remove_spelling(const std::string
  3565.         &word, Xapian::termcount freqdec=1) const
  3566.  
  3567.         The word's frequency is decreased, and if would become zero or less
  3568.         then the word is removed completely.
  3569.  
  3570.         Parameters:
  3571.         -----------
  3572.  
  3573.         word:  The word to remove.
  3574.  
  3575.         freqdec:  How much to decrease its frequency by (default 1). 
  3576.         """
  3577.         return _xapian.WritableDatabase_remove_spelling(*args)
  3578.  
  3579.     
  3580.     def add_synonym(*args):
  3581.         '''
  3582.         Add a synonym for a term.
  3583.  
  3584.         void Xapian::WritableDatabase::add_synonym(const std::string &term,
  3585.         const std::string &synonym) const
  3586.  
  3587.         If synonym is already a synonym for term, then no action is taken. 
  3588.         '''
  3589.         return _xapian.WritableDatabase_add_synonym(*args)
  3590.  
  3591.     
  3592.     def remove_synonym(*args):
  3593.         """
  3594.         Remove a synonym for a term.
  3595.  
  3596.         void Xapian::WritableDatabase::remove_synonym(const std::string &term,
  3597.         const std::string &synonym) const
  3598.  
  3599.         If synonym isn't a synonym for term, then no action is taken. 
  3600.         """
  3601.         return _xapian.WritableDatabase_remove_synonym(*args)
  3602.  
  3603.     
  3604.     def clear_synonyms(*args):
  3605.         '''
  3606.         Remove all synonyms for a term.
  3607.  
  3608.         void Xapian::WritableDatabase::clear_synonyms(const std::string &term)
  3609.         const
  3610.  
  3611.         If term has no synonyms, no action is taken. 
  3612.         '''
  3613.         return _xapian.WritableDatabase_clear_synonyms(*args)
  3614.  
  3615.     
  3616.     def set_metadata(*args):
  3617.         """
  3618.         Set the user-specified metadata associated with a given key.
  3619.  
  3620.         void Xapian::WritableDatabase::set_metadata(const std::string &key,
  3621.         const std::string &value)
  3622.  
  3623.         This method sets the metadata value associated with a given key. If
  3624.         there is already a metadata value stored in the database with the same
  3625.         key, the old value is replaced. If you want to delete an existing item
  3626.         of metadata, just set its value to the empty string.
  3627.  
  3628.         User-specified metadata allows you to store arbitrary information in
  3629.         the form of (key,tag) pairs.
  3630.  
  3631.         There's no hard limit on the number of metadata items, or the size of
  3632.         the metadata values. Metadata keys have a limited length, which
  3633.         depends on the backend. We recommend limiting them to 200 bytes. Empty
  3634.         keys are not valid, and specifying one will cause an exception.
  3635.  
  3636.         Metadata modifications are committed to disk in the same way as
  3637.         modifications to the documents in the database are: i.e.,
  3638.         modifications are atomic, and won't be committed to disk immediately
  3639.         (see flush() for more details). This allows metadata to be used to
  3640.         link databases with versioned external resources by storing the
  3641.         appropriate version number in a metadata item.
  3642.  
  3643.         You can also use the metadata to store arbitrary extra information
  3644.         associated with terms, documents, or postings by encoding the termname
  3645.         and/or document id into the metadata key.
  3646.  
  3647.         Parameters:
  3648.         -----------
  3649.  
  3650.         key:  The key of the metadata item to set.
  3651.  
  3652.         value:  The value of the metadata item to set.
  3653.  
  3654.         Parameters:
  3655.         -----------
  3656.  
  3657.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3658.         writing to the database.
  3659.  
  3660.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3661.         corrupt state.
  3662.  
  3663.         Xapian::InvalidArgumentError:  will be thrown if the key supplied is
  3664.         empty. 
  3665.         """
  3666.         return _xapian.WritableDatabase_set_metadata(*args)
  3667.  
  3668.     
  3669.     def __str__(*args):
  3670.         '''
  3671.         Return a string describing this object.
  3672.  
  3673.         std::string Xapian::WritableDatabase::get_description() const 
  3674.         '''
  3675.         return _xapian.WritableDatabase___str__(*args)
  3676.  
  3677.     
  3678.     def get_description(*args):
  3679.         '''
  3680.         Return a string describing this object.
  3681.  
  3682.         std::string Xapian::WritableDatabase::get_description() const 
  3683.         '''
  3684.         return _xapian.WritableDatabase_get_description(*args)
  3685.  
  3686.  
  3687. WritableDatabase.flush = new_instancemethod(_xapian.WritableDatabase_flush, None, WritableDatabase)
  3688. WritableDatabase.begin_transaction = new_instancemethod(_xapian.WritableDatabase_begin_transaction, None, WritableDatabase)
  3689. WritableDatabase.commit_transaction = new_instancemethod(_xapian.WritableDatabase_commit_transaction, None, WritableDatabase)
  3690. WritableDatabase.cancel_transaction = new_instancemethod(_xapian.WritableDatabase_cancel_transaction, None, WritableDatabase)
  3691. WritableDatabase.add_document = new_instancemethod(_xapian.WritableDatabase_add_document, None, WritableDatabase)
  3692. WritableDatabase.delete_document = new_instancemethod(_xapian.WritableDatabase_delete_document, None, WritableDatabase)
  3693. WritableDatabase.replace_document = new_instancemethod(_xapian.WritableDatabase_replace_document, None, WritableDatabase)
  3694. WritableDatabase.add_spelling = new_instancemethod(_xapian.WritableDatabase_add_spelling, None, WritableDatabase)
  3695. WritableDatabase.remove_spelling = new_instancemethod(_xapian.WritableDatabase_remove_spelling, None, WritableDatabase)
  3696. WritableDatabase.add_synonym = new_instancemethod(_xapian.WritableDatabase_add_synonym, None, WritableDatabase)
  3697. WritableDatabase.remove_synonym = new_instancemethod(_xapian.WritableDatabase_remove_synonym, None, WritableDatabase)
  3698. WritableDatabase.clear_synonyms = new_instancemethod(_xapian.WritableDatabase_clear_synonyms, None, WritableDatabase)
  3699. WritableDatabase.set_metadata = new_instancemethod(_xapian.WritableDatabase_set_metadata, None, WritableDatabase)
  3700. WritableDatabase.__str__ = new_instancemethod(_xapian.WritableDatabase___str__, None, WritableDatabase)
  3701. WritableDatabase.get_description = new_instancemethod(_xapian.WritableDatabase_get_description, None, WritableDatabase)
  3702. WritableDatabase_swigregister = _xapian.WritableDatabase_swigregister
  3703. WritableDatabase_swigregister(WritableDatabase)
  3704. DB_CREATE_OR_OPEN = _xapian.DB_CREATE_OR_OPEN
  3705. DB_CREATE = _xapian.DB_CREATE
  3706. DB_CREATE_OR_OVERWRITE = _xapian.DB_CREATE_OR_OVERWRITE
  3707. DB_OPEN = _xapian.DB_OPEN
  3708.  
  3709. def open_stub(*args):
  3710.     '''
  3711.     Construct a Database object for a stub database file.
  3712.  
  3713.     XAPIAN_VISIBILITY_DEFAULT Database Xapian::Auto::open_stub(const
  3714.     std::string &file)
  3715.  
  3716.     The stub database file contains serialised parameters for one or more
  3717.     databases.
  3718.  
  3719.     Parameters:
  3720.     -----------
  3721.  
  3722.     file:  pathname of the stub database file. 
  3723.     '''
  3724.     return _xapian.open_stub(*args)
  3725.  
  3726.  
  3727. def inmemory_open(*args):
  3728.     '''
  3729.     Construct a Database object for update access to an InMemory database.
  3730.  
  3731.     XAPIAN_VISIBILITY_DEFAULT WritableDatabase Xapian::InMemory::open()
  3732.  
  3733.     A new, empty database is created for each call. 
  3734.     '''
  3735.     return _xapian.inmemory_open(*args)
  3736.  
  3737.  
  3738. class Query(object):
  3739.     '''
  3740.     Class representing a query.
  3741.  
  3742.     Queries are represented as a tree of objects. 
  3743.     '''
  3744.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  3745.     __repr__ = _swig_repr
  3746.     OP_AND = _xapian.Query_OP_AND
  3747.     OP_OR = _xapian.Query_OP_OR
  3748.     OP_AND_NOT = _xapian.Query_OP_AND_NOT
  3749.     OP_XOR = _xapian.Query_OP_XOR
  3750.     OP_AND_MAYBE = _xapian.Query_OP_AND_MAYBE
  3751.     OP_FILTER = _xapian.Query_OP_FILTER
  3752.     OP_NEAR = _xapian.Query_OP_NEAR
  3753.     OP_PHRASE = _xapian.Query_OP_PHRASE
  3754.     OP_VALUE_RANGE = _xapian.Query_OP_VALUE_RANGE
  3755.     OP_SCALE_WEIGHT = _xapian.Query_OP_SCALE_WEIGHT
  3756.     OP_ELITE_SET = _xapian.Query_OP_ELITE_SET
  3757.     OP_VALUE_GE = _xapian.Query_OP_VALUE_GE
  3758.     OP_VALUE_LE = _xapian.Query_OP_VALUE_LE
  3759.     
  3760.     def __init__(self, *args):
  3761.         '''
  3762.         Construct a value comparison query on a document value.
  3763.  
  3764.         Xapian::Query::Query(Query::op op_, Xapian::valueno valno, const
  3765.         std::string &value)
  3766.  
  3767.         This query matches those documents which have a value stored in the
  3768.         slot given by valno which compares, as specified by the operator, to
  3769.         value.
  3770.  
  3771.         Parameters:
  3772.         -----------
  3773.  
  3774.         op_:  The operator to use for the query. Currently, must be
  3775.         OP_VALUE_GE or OP_VALUE_LE.
  3776.  
  3777.         valno:  The slot number to get the value from.
  3778.  
  3779.         value:  The value to compare. 
  3780.         '''
  3781.         _xapian.Query_swiginit(self, _xapian.new_Query(*args))
  3782.  
  3783.     __swig_destroy__ = _xapian.delete_Query
  3784.     
  3785.     def get_length(*args):
  3786.         '''
  3787.         Get the length of the query, used by some ranking formulae.
  3788.  
  3789.         Xapian::termcount Xapian::Query::get_length() const
  3790.  
  3791.         This value is calculated automatically - if you want to override it
  3792.         you can pass a different value to Enquire::set_query(). 
  3793.         '''
  3794.         return _xapian.Query_get_length(*args)
  3795.  
  3796.     
  3797.     def get_terms_begin(*args):
  3798.         '''
  3799.         Return a Xapian::TermIterator returning all the terms in the query, in
  3800.         order of termpos.
  3801.  
  3802.         TermIterator Xapian::Query::get_terms_begin() const
  3803.  
  3804.         If multiple terms have the same term position, their order is
  3805.         unspecified. Duplicates (same term and termpos) will be removed. 
  3806.         '''
  3807.         return _xapian.Query_get_terms_begin(*args)
  3808.  
  3809.     
  3810.     def get_terms_end(*args):
  3811.         '''
  3812.         Return a Xapian::TermIterator to the end of the list of terms in the
  3813.         query.
  3814.  
  3815.         TermIterator Xapian::Query::get_terms_end() const 
  3816.         '''
  3817.         return _xapian.Query_get_terms_end(*args)
  3818.  
  3819.     
  3820.     def empty(*args):
  3821.         '''
  3822.         Test if the query is empty (i.e.
  3823.  
  3824.         bool Xapian::Query::empty() const
  3825.  
  3826.         was constructed using the default ctor or with an empty iterator
  3827.         ctor). 
  3828.         '''
  3829.         return _xapian.Query_empty(*args)
  3830.  
  3831.     
  3832.     def __str__(*args):
  3833.         '''
  3834.         Return a string describing this object.
  3835.  
  3836.         std::string Xapian::Query::get_description() const 
  3837.         '''
  3838.         return _xapian.Query___str__(*args)
  3839.  
  3840.     
  3841.     def get_description(*args):
  3842.         '''
  3843.         Return a string describing this object.
  3844.  
  3845.         std::string Xapian::Query::get_description() const 
  3846.         '''
  3847.         return _xapian.Query_get_description(*args)
  3848.  
  3849.  
  3850. Query.get_length = new_instancemethod(_xapian.Query_get_length, None, Query)
  3851. Query.get_terms_begin = new_instancemethod(_xapian.Query_get_terms_begin, None, Query)
  3852. Query.get_terms_end = new_instancemethod(_xapian.Query_get_terms_end, None, Query)
  3853. Query.empty = new_instancemethod(_xapian.Query_empty, None, Query)
  3854. Query.__str__ = new_instancemethod(_xapian.Query___str__, None, Query)
  3855. Query.get_description = new_instancemethod(_xapian.Query_get_description, None, Query)
  3856. Query_swigregister = _xapian.Query_swigregister
  3857. Query_swigregister(Query)
  3858. quartz_open = _xapian.quartz_open
  3859.  
  3860. def flint_open(*args):
  3861.     '''
  3862.     Construct a Database object for update access to a Flint database.
  3863.  
  3864.     XAPIAN_VISIBILITY_DEFAULT WritableDatabase Xapian::Flint::open(const
  3865.     std::string &dir, int action, int block_size=8192)
  3866.  
  3867.     Parameters:
  3868.     -----------
  3869.  
  3870.     dir:  pathname of the directory containing the database.
  3871.  
  3872.     action:  determines handling of existing/non-existing database:
  3873.     Xapian::DB_CREATE fail if database already exist, otherwise create new
  3874.     database.
  3875.  
  3876.     Xapian::DB_CREATE_OR_OPEN open existing database, or create new
  3877.     database if none exists.
  3878.  
  3879.     Xapian::DB_CREATE_OR_OVERWRITE overwrite existing database, or create
  3880.     new database if none exists.
  3881.  
  3882.     Xapian::DB_OPEN open existing database, failing if none exists.
  3883.  
  3884.     block_size:  the Btree blocksize to use (in bytes), which must be a
  3885.     power of two between 2048 and 65536 (inclusive). The default (also
  3886.     used if an invalid value if passed) is 8192 bytes. This parameter is
  3887.     ignored when opening an existing database. 
  3888.     '''
  3889.     return _xapian.flint_open(*args)
  3890.  
  3891.  
  3892. def remote_open(*args):
  3893.     """
  3894.     Construct a Database object for read-only access to a remote database
  3895.     accessed via a program.
  3896.  
  3897.     XAPIAN_VISIBILITY_DEFAULT Database Xapian::Remote::open(const
  3898.     std::string &program, const std::string &args, Xapian::timeout
  3899.     timeout=10000)
  3900.  
  3901.     Access to the remote database is done by running an external program
  3902.     and communicating with it on stdin/stdout.
  3903.  
  3904.     Parameters:
  3905.     -----------
  3906.  
  3907.     program:  the external program to run.
  3908.  
  3909.     args:  space-separated list of arguments to pass to program.
  3910.  
  3911.     timeout:  timeout in milliseconds. If this timeout is exceeded for any
  3912.     individual operation on the remote database then
  3913.     Xapian::NetworkTimeoutError is thrown. A timeout of 0 means don't
  3914.     timeout. (Default is 10000ms, which is 10 seconds). 
  3915.     """
  3916.     return _xapian.remote_open(*args)
  3917.  
  3918.  
  3919. def remote_open_writable(*args):
  3920.     """
  3921.     Construct a WritableDatabase object for update access to a remote
  3922.     database accessed via a program.
  3923.  
  3924.     XAPIAN_VISIBILITY_DEFAULT WritableDatabase
  3925.     Xapian::Remote::open_writable(const std::string &program, const
  3926.     std::string &args, Xapian::timeout timeout=0)
  3927.  
  3928.     Access to the remote database is done by running an external program
  3929.     and communicating with it on stdin/stdout.
  3930.  
  3931.     Parameters:
  3932.     -----------
  3933.  
  3934.     program:  the external program to run.
  3935.  
  3936.     args:  space-separated list of arguments to pass to program.
  3937.  
  3938.     timeout:  timeout in milliseconds. If this timeout is exceeded for any
  3939.     individual operation on the remote database then
  3940.     Xapian::NetworkTimeoutError is thrown. (Default is 0, which means
  3941.     don't timeout). 
  3942.     """
  3943.     return _xapian.remote_open_writable(*args)
  3944.  
  3945.  
  3946. class Stopper(object):
  3947.     '''
  3948.     Base class for stop-word decision functor. 
  3949.     '''
  3950.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  3951.     __repr__ = _swig_repr
  3952.     __swig_destroy__ = _xapian.delete_Stopper
  3953.     
  3954.     def __str__(*args):
  3955.         '''
  3956.         Return a string describing this object.
  3957.  
  3958.         virtual std::string Xapian::Stopper::get_description() const 
  3959.         '''
  3960.         return _xapian.Stopper___str__(*args)
  3961.  
  3962.     
  3963.     def get_description(*args):
  3964.         '''
  3965.         Return a string describing this object.
  3966.  
  3967.         virtual std::string Xapian::Stopper::get_description() const 
  3968.         '''
  3969.         return _xapian.Stopper_get_description(*args)
  3970.  
  3971.     
  3972.     def __init__(self, *args):
  3973.         if self.__class__ == Stopper:
  3974.             args = (None,) + args
  3975.         else:
  3976.             args = (self,) + args
  3977.         _xapian.Stopper_swiginit(self, _xapian.new_Stopper(*args))
  3978.  
  3979.     
  3980.     def __disown__(self):
  3981.         self.this.disown()
  3982.         _xapian.disown_Stopper(self)
  3983.         return weakref_proxy(self)
  3984.  
  3985.  
  3986. Stopper.__call__ = new_instancemethod(_xapian.Stopper___call__, None, Stopper)
  3987. Stopper.__str__ = new_instancemethod(_xapian.Stopper___str__, None, Stopper)
  3988. Stopper.get_description = new_instancemethod(_xapian.Stopper_get_description, None, Stopper)
  3989. Stopper_swigregister = _xapian.Stopper_swigregister
  3990. Stopper_swigregister(Stopper)
  3991.  
  3992. class SimpleStopper(Stopper):
  3993.     '''
  3994.     Simple implementation of Stopper class - this will suit most users. 
  3995.     '''
  3996.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  3997.     __repr__ = _swig_repr
  3998.     
  3999.     def __init__(self, *args):
  4000.         '''
  4001.         Initialise from a pair of iterators.
  4002.  
  4003.         Xapian::SimpleStopper::SimpleStopper(Iterator begin, Iterator end) 
  4004.         '''
  4005.         _xapian.SimpleStopper_swiginit(self, _xapian.new_SimpleStopper(*args))
  4006.  
  4007.     
  4008.     def add(*args):
  4009.         '''
  4010.         Add a single stop word.
  4011.  
  4012.         void Xapian::SimpleStopper::add(const std::string &word) 
  4013.         '''
  4014.         return _xapian.SimpleStopper_add(*args)
  4015.  
  4016.     __swig_destroy__ = _xapian.delete_SimpleStopper
  4017.  
  4018. SimpleStopper.add = new_instancemethod(_xapian.SimpleStopper_add, None, SimpleStopper)
  4019. SimpleStopper_swigregister = _xapian.SimpleStopper_swigregister
  4020. SimpleStopper_swigregister(SimpleStopper)
  4021.  
  4022. class ValueRangeProcessor(object):
  4023.     '''
  4024.     Base class for value range processors. 
  4025.     '''
  4026.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4027.     __repr__ = _swig_repr
  4028.     __swig_destroy__ = _xapian.delete_ValueRangeProcessor
  4029.     
  4030.     def __init__(self, *args):
  4031.         if self.__class__ == ValueRangeProcessor:
  4032.             args = (None,) + args
  4033.         else:
  4034.             args = (self,) + args
  4035.         _xapian.ValueRangeProcessor_swiginit(self, _xapian.new_ValueRangeProcessor(*args))
  4036.  
  4037.     
  4038.     def __disown__(self):
  4039.         self.this.disown()
  4040.         _xapian.disown_ValueRangeProcessor(self)
  4041.         return weakref_proxy(self)
  4042.  
  4043.  
  4044. ValueRangeProcessor.__call__ = new_instancemethod(_xapian.ValueRangeProcessor___call__, None, ValueRangeProcessor)
  4045. ValueRangeProcessor.__call = new_instancemethod(_xapian.ValueRangeProcessor___call, None, ValueRangeProcessor)
  4046. ValueRangeProcessor_swigregister = _xapian.ValueRangeProcessor_swigregister
  4047. ValueRangeProcessor_swigregister(ValueRangeProcessor)
  4048.  
  4049. class StringValueRangeProcessor(ValueRangeProcessor):
  4050.     '''
  4051.     Handle a string range.
  4052.  
  4053.     The end points can be any strings. 
  4054.     '''
  4055.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4056.     __repr__ = _swig_repr
  4057.     
  4058.     def __init__(self, *args):
  4059.         '''
  4060.         Constructor.
  4061.  
  4062.         Xapian::StringValueRangeProcessor::StringValueRangeProcessor(Xapian::v
  4063.         alueno valno_)
  4064.  
  4065.         Parameters:
  4066.         -----------
  4067.  
  4068.         valno_:  The value number to return from operator(). 
  4069.         '''
  4070.         _xapian.StringValueRangeProcessor_swiginit(self, _xapian.new_StringValueRangeProcessor(*args))
  4071.  
  4072.     __swig_destroy__ = _xapian.delete_StringValueRangeProcessor
  4073.  
  4074. StringValueRangeProcessor_swigregister = _xapian.StringValueRangeProcessor_swigregister
  4075. StringValueRangeProcessor_swigregister(StringValueRangeProcessor)
  4076.  
  4077. class DateValueRangeProcessor(ValueRangeProcessor):
  4078.     '''
  4079.     Handle a date range.
  4080.  
  4081.     Begin and end must be dates in a recognised format. 
  4082.     '''
  4083.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4084.     __repr__ = _swig_repr
  4085.     
  4086.     def __init__(self, *args):
  4087.         '''
  4088.         Constructor.
  4089.  
  4090.         Xapian::DateValueRangeProcessor::DateValueRangeProcessor(Xapian::value
  4091.         no valno_, bool prefer_mdy_=false, int epoch_year_=1970)
  4092.  
  4093.         Parameters:
  4094.         -----------
  4095.  
  4096.         valno_:  The value number to return from operator().
  4097.  
  4098.         prefer_mdy_:  Should ambiguous dates be interpreted as month/day/year
  4099.         rather than day/month/year? (default: false)
  4100.  
  4101.         epoch_year_:  Year to use as the epoch for dates with 2 digit years
  4102.         (default: 1970, so 1/1/69 is 2069 while 1/1/70 is 1970). 
  4103.         '''
  4104.         _xapian.DateValueRangeProcessor_swiginit(self, _xapian.new_DateValueRangeProcessor(*args))
  4105.  
  4106.     __swig_destroy__ = _xapian.delete_DateValueRangeProcessor
  4107.  
  4108. DateValueRangeProcessor_swigregister = _xapian.DateValueRangeProcessor_swigregister
  4109. DateValueRangeProcessor_swigregister(DateValueRangeProcessor)
  4110.  
  4111. class NumberValueRangeProcessor(ValueRangeProcessor):
  4112.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4113.     __repr__ = _swig_repr
  4114.     
  4115.     def __init__(self, *args):
  4116.         _xapian.NumberValueRangeProcessor_swiginit(self, _xapian.new_NumberValueRangeProcessor(*args))
  4117.  
  4118.     __swig_destroy__ = _xapian.delete_NumberValueRangeProcessor
  4119.  
  4120. NumberValueRangeProcessor_swigregister = _xapian.NumberValueRangeProcessor_swigregister
  4121. NumberValueRangeProcessor_swigregister(NumberValueRangeProcessor)
  4122.  
  4123. class QueryParser(object):
  4124.     '''
  4125.     Build a Xapian::Query object from a user query string. 
  4126.     '''
  4127.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4128.     __repr__ = _swig_repr
  4129.     FLAG_BOOLEAN = _xapian.QueryParser_FLAG_BOOLEAN
  4130.     FLAG_PHRASE = _xapian.QueryParser_FLAG_PHRASE
  4131.     FLAG_LOVEHATE = _xapian.QueryParser_FLAG_LOVEHATE
  4132.     FLAG_BOOLEAN_ANY_CASE = _xapian.QueryParser_FLAG_BOOLEAN_ANY_CASE
  4133.     FLAG_WILDCARD = _xapian.QueryParser_FLAG_WILDCARD
  4134.     FLAG_PURE_NOT = _xapian.QueryParser_FLAG_PURE_NOT
  4135.     FLAG_PARTIAL = _xapian.QueryParser_FLAG_PARTIAL
  4136.     FLAG_SPELLING_CORRECTION = _xapian.QueryParser_FLAG_SPELLING_CORRECTION
  4137.     FLAG_SYNONYM = _xapian.QueryParser_FLAG_SYNONYM
  4138.     FLAG_AUTO_SYNONYMS = _xapian.QueryParser_FLAG_AUTO_SYNONYMS
  4139.     FLAG_AUTO_MULTIWORD_SYNONYMS = _xapian.QueryParser_FLAG_AUTO_MULTIWORD_SYNONYMS
  4140.     STEM_NONE = _xapian.QueryParser_STEM_NONE
  4141.     STEM_SOME = _xapian.QueryParser_STEM_SOME
  4142.     STEM_ALL = _xapian.QueryParser_STEM_ALL
  4143.     
  4144.     def __init__(self, *args):
  4145.         '''
  4146.         Default constructor.
  4147.  
  4148.         Xapian::QueryParser::QueryParser() 
  4149.         '''
  4150.         _xapian.QueryParser_swiginit(self, _xapian.new_QueryParser(*args))
  4151.  
  4152.     __swig_destroy__ = _xapian.delete_QueryParser
  4153.     
  4154.     def set_stemmer(*args):
  4155.         '''
  4156.         Set the stemmer.
  4157.  
  4158.         void Xapian::QueryParser::set_stemmer(const Xapian::Stem &stemmer)
  4159.  
  4160.         This sets the stemming algorithm which will be used by the query
  4161.         parser. Note that the stemming algorithm will only be used according
  4162.         to the stemming strategy set by set_stemming_strategy(), which
  4163.         defaults to STEM_NONE. Therefore, to use a stemming algorithm, you
  4164.         will also need to call set_stemming_strategy() with a value other than
  4165.         STEM_NONE. 
  4166.         '''
  4167.         return _xapian.QueryParser_set_stemmer(*args)
  4168.  
  4169.     
  4170.     def set_stemming_strategy(*args):
  4171.         '''
  4172.         Set the stemming strategy.
  4173.  
  4174.         void Xapian::QueryParser::set_stemming_strategy(stem_strategy
  4175.         strategy)
  4176.  
  4177.         This controls how the query parser will apply the stemming algorithm.
  4178.         The default value is STEM_NONE. The possible values are:
  4179.  
  4180.         STEM_NONE: Don\'t perform any stemming.
  4181.  
  4182.         STEM_SOME: Search for stemmed forms of terms except for those which
  4183.         start with a capital letter, or are followed by certain characters
  4184.         (currently: (/@<>=*[{" ), or are used with operators which need
  4185.         positional information. Stemmed terms are prefixed with \'Z\'.
  4186.  
  4187.         STEM_ALL: Search for stemmed forms of all words (note: no \'Z\' prefix
  4188.         is added).
  4189.  
  4190.         Note that the stemming algorithm is only applied to words in
  4191.         probabilistic fields - boolean filter terms are never stemmed. 
  4192.         '''
  4193.         return _xapian.QueryParser_set_stemming_strategy(*args)
  4194.  
  4195.     
  4196.     def set_stopper(*args):
  4197.         '''
  4198.         Set the stopper.
  4199.  
  4200.         void Xapian::QueryParser::set_stopper(const Stopper *stop=NULL) 
  4201.         '''
  4202.         return _xapian.QueryParser_set_stopper(*args)
  4203.  
  4204.     
  4205.     def set_default_op(*args):
  4206.         '''
  4207.         Set the default boolean operator.
  4208.  
  4209.         void Xapian::QueryParser::set_default_op(Query::op default_op) 
  4210.         '''
  4211.         return _xapian.QueryParser_set_default_op(*args)
  4212.  
  4213.     
  4214.     def get_default_op(*args):
  4215.         '''
  4216.         Get the default boolean operator.
  4217.  
  4218.         Query::op Xapian::QueryParser::get_default_op() const 
  4219.         '''
  4220.         return _xapian.QueryParser_get_default_op(*args)
  4221.  
  4222.     
  4223.     def set_database(*args):
  4224.         '''
  4225.         Specify the database being searched.
  4226.  
  4227.         void Xapian::QueryParser::set_database(const Database &db) 
  4228.         '''
  4229.         return _xapian.QueryParser_set_database(*args)
  4230.  
  4231.     
  4232.     def parse_query(*args):
  4233.         '''
  4234.         Parse a query.
  4235.  
  4236.         Query Xapian::QueryParser::parse_query(const std::string
  4237.         &query_string, unsigned flags=FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE,
  4238.         const std::string &default_prefix="")
  4239.  
  4240.         Parameters:
  4241.         -----------
  4242.  
  4243.         query_string:  A free-text query as entered by a user
  4244.  
  4245.         flags:  Zero or more Query::feature_flag specifying what features the
  4246.         QueryParser should support. Combine multiple values with bitwise-or
  4247.         (|).
  4248.  
  4249.         default_prefix:  The default term prefix to use (default none). For
  4250.         example, you can pass "A" when parsing an "Author" field. 
  4251.         '''
  4252.         return _xapian.QueryParser_parse_query(*args)
  4253.  
  4254.     
  4255.     def add_prefix(*args):
  4256.         '''
  4257.         Add a probabilistic term prefix.
  4258.  
  4259.         void Xapian::QueryParser::add_prefix(const std::string &field, const
  4260.         std::string &prefix)
  4261.  
  4262.         For example:
  4263.  
  4264.         This allows the user to search for author:Orwell which will be
  4265.         converted to a search for the term "Aorwell".
  4266.  
  4267.         Multiple fields can be mapped to the same prefix. For example, you can
  4268.         make title: and subject: aliases for each other.
  4269.  
  4270.         As of 1.0.4, you can call this method multiple times with the same
  4271.         value of field to allow a single field to be mapped to multiple
  4272.         prefixes. Multiple terms being generated for such a field, and
  4273.         combined with  Xapian::Query::OP_OR.
  4274.  
  4275.         If any prefixes are specified for the empty field name (i.e. you call
  4276.         this method with an empty string as the first parameter) these
  4277.         prefixes will be used as the default prefix. If you do this and also
  4278.         specify the default_prefix parameter to  parse_query(), then the
  4279.         default_prefix parameter will override.
  4280.  
  4281.         If you call  add_prefix() and  add_boolean_prefix() for the same value
  4282.         of field, a Xapian::InvalidOperationError exception will be thrown.
  4283.  
  4284.         In 1.0.3 and earlier, subsequent calls to this method with the same
  4285.         value of field had no effect.
  4286.  
  4287.         Parameters:
  4288.         -----------
  4289.  
  4290.         field:  The user visible field name
  4291.  
  4292.         prefix:  The term prefix to map this to 
  4293.         '''
  4294.         return _xapian.QueryParser_add_prefix(*args)
  4295.  
  4296.     
  4297.     def add_boolean_prefix(*args):
  4298.         '''
  4299.         Add a boolean term prefix allowing the user to restrict a search with
  4300.         a boolean filter specified in the free text query.
  4301.  
  4302.         void Xapian::QueryParser::add_boolean_prefix(const std::string &field,
  4303.         const std::string &prefix)
  4304.  
  4305.         For example:
  4306.  
  4307.         This allows the user to restrict a search with site:xapian.org which
  4308.         will be converted to Hxapian.org combined with any probabilistic query
  4309.         with  Xapian::Query::OP_FILTER.
  4310.  
  4311.         If multiple boolean filters are specified in a query for the same
  4312.         prefix, they will be combined with the  Xapian::Query::OP_OR operator.
  4313.         Then, if there are boolean filters for different prefixes, they will
  4314.         be combined with the  Xapian::Query::OP_AND operator.
  4315.  
  4316.         Multiple fields can be mapped to the same prefix (so for example you
  4317.         can make site: and domain: aliases for each other). Instances of
  4318.         fields with different aliases but the same prefix will still be
  4319.         combined with the OR operator.
  4320.  
  4321.         For example, if "site" and "domain" map to "H", but author maps
  4322.         to "A", a search for "site:foo domain:bar author:Fred" will map to
  4323.         "(Hfoo OR Hbar) AND Afred".
  4324.  
  4325.         As of 1.0.4, you can call this method multiple times with the same
  4326.         value of field to allow a single field to be mapped to multiple
  4327.         prefixes. Multiple terms being generated for such a field, and
  4328.         combined with  Xapian::Query::OP_OR.
  4329.  
  4330.         Calling this method with an empty string for field will cause a
  4331.         Xapian::InvalidArgumentError.
  4332.  
  4333.         If you call  add_prefix() and  add_boolean_prefix() for the same value
  4334.         of field, a Xapian::InvalidOperationError exception will be thrown.
  4335.  
  4336.         In 1.0.3 and earlier, subsequent calls to this method with the same
  4337.         value of field had no effect.
  4338.  
  4339.         Parameters:
  4340.         -----------
  4341.  
  4342.         field:  The user visible field name
  4343.  
  4344.         prefix:  The term prefix to map this to 
  4345.         '''
  4346.         return _xapian.QueryParser_add_boolean_prefix(*args)
  4347.  
  4348.     
  4349.     def stoplist_begin(*args):
  4350.         '''
  4351.         Iterate over terms omitted from the query as stopwords.
  4352.  
  4353.         TermIterator Xapian::QueryParser::stoplist_begin() const 
  4354.         '''
  4355.         return _xapian.QueryParser_stoplist_begin(*args)
  4356.  
  4357.     
  4358.     def stoplist_end(*args):
  4359.         '''TermIterator Xapian::QueryParser::stoplist_end() const '''
  4360.         return _xapian.QueryParser_stoplist_end(*args)
  4361.  
  4362.     
  4363.     def unstem_begin(*args):
  4364.         '''
  4365.         Iterate over unstemmed forms of the given (stemmed) term used in the
  4366.         query.
  4367.  
  4368.         TermIterator Xapian::QueryParser::unstem_begin(const std::string
  4369.         &term) const 
  4370.         '''
  4371.         return _xapian.QueryParser_unstem_begin(*args)
  4372.  
  4373.     
  4374.     def unstem_end(*args):
  4375.         '''
  4376.         TermIterator
  4377.         Xapian::QueryParser::unstem_end(const std::string &) const 
  4378.         '''
  4379.         return _xapian.QueryParser_unstem_end(*args)
  4380.  
  4381.     
  4382.     def add_valuerangeprocessor(*args):
  4383.         '''
  4384.         Register a ValueRangeProcessor.
  4385.  
  4386.         void Xapian::QueryParser::add_valuerangeprocessor(Xapian::ValueRangePr
  4387.         ocessor *vrproc) 
  4388.         '''
  4389.         return _xapian.QueryParser_add_valuerangeprocessor(*args)
  4390.  
  4391.     
  4392.     def get_corrected_query_string(*args):
  4393.         '''
  4394.         Get the spelling-corrected query string.
  4395.  
  4396.         std::string Xapian::QueryParser::get_corrected_query_string() const
  4397.  
  4398.         This will only be set if FLAG_SPELLING_CORRECTION is specified when
  4399.         QueryParser::parse_query() was last called.
  4400.  
  4401.         If there were no corrections, an empty string is returned. 
  4402.         '''
  4403.         return _xapian.QueryParser_get_corrected_query_string(*args)
  4404.  
  4405.     
  4406.     def __str__(*args):
  4407.         '''
  4408.         Return a string describing this object.
  4409.  
  4410.         std::string Xapian::QueryParser::get_description() const 
  4411.         '''
  4412.         return _xapian.QueryParser___str__(*args)
  4413.  
  4414.     
  4415.     def get_description(*args):
  4416.         '''
  4417.         Return a string describing this object.
  4418.  
  4419.         std::string Xapian::QueryParser::get_description() const 
  4420.         '''
  4421.         return _xapian.QueryParser_get_description(*args)
  4422.  
  4423.  
  4424. QueryParser.set_stemmer = new_instancemethod(_xapian.QueryParser_set_stemmer, None, QueryParser)
  4425. QueryParser.set_stemming_strategy = new_instancemethod(_xapian.QueryParser_set_stemming_strategy, None, QueryParser)
  4426. QueryParser.set_stopper = new_instancemethod(_xapian.QueryParser_set_stopper, None, QueryParser)
  4427. QueryParser.set_default_op = new_instancemethod(_xapian.QueryParser_set_default_op, None, QueryParser)
  4428. QueryParser.get_default_op = new_instancemethod(_xapian.QueryParser_get_default_op, None, QueryParser)
  4429. QueryParser.set_database = new_instancemethod(_xapian.QueryParser_set_database, None, QueryParser)
  4430. QueryParser.parse_query = new_instancemethod(_xapian.QueryParser_parse_query, None, QueryParser)
  4431. QueryParser.add_prefix = new_instancemethod(_xapian.QueryParser_add_prefix, None, QueryParser)
  4432. QueryParser.add_boolean_prefix = new_instancemethod(_xapian.QueryParser_add_boolean_prefix, None, QueryParser)
  4433. QueryParser.stoplist_begin = new_instancemethod(_xapian.QueryParser_stoplist_begin, None, QueryParser)
  4434. QueryParser.stoplist_end = new_instancemethod(_xapian.QueryParser_stoplist_end, None, QueryParser)
  4435. QueryParser.unstem_begin = new_instancemethod(_xapian.QueryParser_unstem_begin, None, QueryParser)
  4436. QueryParser.unstem_end = new_instancemethod(_xapian.QueryParser_unstem_end, None, QueryParser)
  4437. QueryParser.add_valuerangeprocessor = new_instancemethod(_xapian.QueryParser_add_valuerangeprocessor, None, QueryParser)
  4438. QueryParser.get_corrected_query_string = new_instancemethod(_xapian.QueryParser_get_corrected_query_string, None, QueryParser)
  4439. QueryParser.__str__ = new_instancemethod(_xapian.QueryParser___str__, None, QueryParser)
  4440. QueryParser.get_description = new_instancemethod(_xapian.QueryParser_get_description, None, QueryParser)
  4441. QueryParser_swigregister = _xapian.QueryParser_swigregister
  4442. QueryParser_swigregister(QueryParser)
  4443. sortable_serialise = _xapian.sortable_serialise
  4444. sortable_unserialise = _xapian.sortable_unserialise
  4445.  
  4446. class Stem(object):
  4447.     '''
  4448.     Class representing a stemming algorithm. 
  4449.     '''
  4450.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4451.     __repr__ = _swig_repr
  4452.     
  4453.     def __init__(self, *args):
  4454.         """
  4455.         Construct a Xapian::Stem object for a particular language.
  4456.  
  4457.         Xapian::Stem::Stem(const std::string &language)
  4458.  
  4459.         Parameters:
  4460.         -----------
  4461.  
  4462.         language:  Either the English name for the language or the two letter
  4463.         ISO639 code.
  4464.  
  4465.         The following language names are understood (aliases follow the name):
  4466.  
  4467.         none - don't stem terms
  4468.  
  4469.         danish (da)
  4470.  
  4471.         dutch (nl)
  4472.  
  4473.         english (en) - Martin Porter's 2002 revision of his stemmer
  4474.  
  4475.         english_lovins (lovins) - Lovin's stemmer
  4476.  
  4477.         english_porter (porter) - Porter's stemmer as described in his 1980
  4478.         paper
  4479.  
  4480.         finnish (fi)
  4481.  
  4482.         french (fr)
  4483.  
  4484.         german (de)
  4485.  
  4486.         italian (it)
  4487.  
  4488.         norwegian (no)
  4489.  
  4490.         portuguese (pt)
  4491.  
  4492.         russian (ru)
  4493.  
  4494.         spanish (es)
  4495.  
  4496.         swedish (sv)
  4497.  
  4498.         Parameters:
  4499.         -----------
  4500.  
  4501.         Xapian::InvalidArgumentError:  is thrown if language isn't recognised.
  4502.  
  4503.         """
  4504.         _xapian.Stem_swiginit(self, _xapian.new_Stem(*args))
  4505.  
  4506.     __swig_destroy__ = _xapian.delete_Stem
  4507.     
  4508.     def __str__(*args):
  4509.         '''
  4510.         Return a string describing this object.
  4511.  
  4512.         std::string Xapian::Stem::get_description() const 
  4513.         '''
  4514.         return _xapian.Stem___str__(*args)
  4515.  
  4516.     get_available_languages = staticmethod(_xapian.Stem_get_available_languages)
  4517.     
  4518.     def get_description(*args):
  4519.         '''
  4520.         Return a string describing this object.
  4521.  
  4522.         std::string Xapian::Stem::get_description() const 
  4523.         '''
  4524.         return _xapian.Stem_get_description(*args)
  4525.  
  4526.  
  4527. Stem.__call__ = new_instancemethod(_xapian.Stem___call__, None, Stem)
  4528. Stem.__str__ = new_instancemethod(_xapian.Stem___str__, None, Stem)
  4529. Stem.get_description = new_instancemethod(_xapian.Stem_get_description, None, Stem)
  4530. Stem_swigregister = _xapian.Stem_swigregister
  4531. Stem_swigregister(Stem)
  4532. Stem_get_available_languages = _xapian.Stem_get_available_languages
  4533.  
  4534. class TermGenerator(object):
  4535.     '''
  4536.     Parses a piece of text and generate terms.
  4537.  
  4538.     This module takes a piece of text and parses it to produce words which
  4539.     are then used to generate suitable terms for indexing. The terms
  4540.     generated are suitable for use with Query objects produced by the
  4541.     QueryParser class. 
  4542.     '''
  4543.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4544.     __repr__ = _swig_repr
  4545.     
  4546.     def __init__(self, *args):
  4547.         '''
  4548.         Default constructor.
  4549.  
  4550.         Xapian::TermGenerator::TermGenerator() 
  4551.         '''
  4552.         _xapian.TermGenerator_swiginit(self, _xapian.new_TermGenerator(*args))
  4553.  
  4554.     __swig_destroy__ = _xapian.delete_TermGenerator
  4555.     
  4556.     def set_stemmer(*args):
  4557.         '''
  4558.         Set the Xapian::Stem object to be used for generating stemmed terms.
  4559.  
  4560.         void Xapian::TermGenerator::set_stemmer(const Xapian::Stem &stemmer)
  4561.  
  4562.         '''
  4563.         return _xapian.TermGenerator_set_stemmer(*args)
  4564.  
  4565.     
  4566.     def set_stopper(*args):
  4567.         '''
  4568.         Set the Xapian::Stopper object to be used for identifying stopwords.
  4569.  
  4570.         void Xapian::TermGenerator::set_stopper(const Xapian::Stopper
  4571.         *stop=NULL) 
  4572.         '''
  4573.         return _xapian.TermGenerator_set_stopper(*args)
  4574.  
  4575.     
  4576.     def set_document(*args):
  4577.         '''
  4578.         Set the current document.
  4579.  
  4580.         void Xapian::TermGenerator::set_document(const Xapian::Document &doc)
  4581.  
  4582.         '''
  4583.         return _xapian.TermGenerator_set_document(*args)
  4584.  
  4585.     
  4586.     def get_document(*args):
  4587.         '''
  4588.         Get the current document.
  4589.  
  4590.         const Xapian::Document& Xapian::TermGenerator::get_document() const 
  4591.         '''
  4592.         return _xapian.TermGenerator_get_document(*args)
  4593.  
  4594.     
  4595.     def set_database(*args):
  4596.         '''
  4597.         Set the database to index spelling data to.
  4598.  
  4599.         void Xapian::TermGenerator::set_database(const
  4600.         Xapian::WritableDatabase &db) 
  4601.         '''
  4602.         return _xapian.TermGenerator_set_database(*args)
  4603.  
  4604.     FLAG_SPELLING = _xapian.TermGenerator_FLAG_SPELLING
  4605.     
  4606.     def set_flags(*args):
  4607.         '''
  4608.         Set flags.
  4609.  
  4610.         flags Xapian::TermGenerator::set_flags(flags toggle, flags
  4611.         mask=flags(0))
  4612.  
  4613.         The new value of flags is: (flags & mask) ^ toggle
  4614.  
  4615.         To just set the flags, pass the new flags in toggle and the default
  4616.         value for mask.
  4617.  
  4618.         Parameters:
  4619.         -----------
  4620.  
  4621.         toggle:  Flags to XOR.
  4622.  
  4623.         mask:  Flags to AND with first.
  4624.  
  4625.         The old flags setting. 
  4626.         '''
  4627.         return _xapian.TermGenerator_set_flags(*args)
  4628.  
  4629.     
  4630.     def index_text(*args):
  4631.         '''
  4632.         Index some text in a std::string.
  4633.  
  4634.         void Xapian::TermGenerator::index_text(const std::string &text,
  4635.         Xapian::termcount weight=1, const std::string &prefix="")
  4636.  
  4637.         Parameters:
  4638.         -----------
  4639.  
  4640.         weight:  The wdf increment (default 1).
  4641.  
  4642.         prefix:  The term prefix to use (default is no prefix). 
  4643.         '''
  4644.         return _xapian.TermGenerator_index_text(*args)
  4645.  
  4646.     
  4647.     def index_text_without_positions(*args):
  4648.         '''
  4649.         Index some text in a std::string without positional information.
  4650.  
  4651.         void Xapian::TermGenerator::index_text_without_positions(const
  4652.         std::string &text, Xapian::termcount weight=1, const std::string
  4653.         &prefix="")
  4654.  
  4655.         Just like index_text, but no positional information is generated. This
  4656.         means that the database will be significantly smaller, but that phrase
  4657.         searching and NEAR won\'t be supported. 
  4658.         '''
  4659.         return _xapian.TermGenerator_index_text_without_positions(*args)
  4660.  
  4661.     
  4662.     def increase_termpos(*args):
  4663.         '''
  4664.         Increase the termpos used by index_text by delta.
  4665.  
  4666.         void Xapian::TermGenerator::increase_termpos(Xapian::termcount
  4667.         delta=100)
  4668.  
  4669.         This can be used to prevent phrase searches from spanning two
  4670.         unconnected blocks of text (e.g. the title and body text). 
  4671.         '''
  4672.         return _xapian.TermGenerator_increase_termpos(*args)
  4673.  
  4674.     
  4675.     def get_termpos(*args):
  4676.         '''
  4677.         Get the current term position.
  4678.  
  4679.         Xapian::termcount Xapian::TermGenerator::get_termpos() const 
  4680.         '''
  4681.         return _xapian.TermGenerator_get_termpos(*args)
  4682.  
  4683.     
  4684.     def set_termpos(*args):
  4685.         '''
  4686.         Set the current term position.
  4687.  
  4688.         void Xapian::TermGenerator::set_termpos(Xapian::termcount termpos) 
  4689.         '''
  4690.         return _xapian.TermGenerator_set_termpos(*args)
  4691.  
  4692.     
  4693.     def __str__(*args):
  4694.         '''
  4695.         Return a string describing this object.
  4696.  
  4697.         std::string Xapian::TermGenerator::get_description() const 
  4698.         '''
  4699.         return _xapian.TermGenerator___str__(*args)
  4700.  
  4701.  
  4702. TermGenerator.set_stemmer = new_instancemethod(_xapian.TermGenerator_set_stemmer, None, TermGenerator)
  4703. TermGenerator.set_stopper = new_instancemethod(_xapian.TermGenerator_set_stopper, None, TermGenerator)
  4704. TermGenerator.set_document = new_instancemethod(_xapian.TermGenerator_set_document, None, TermGenerator)
  4705. TermGenerator.get_document = new_instancemethod(_xapian.TermGenerator_get_document, None, TermGenerator)
  4706. TermGenerator.set_database = new_instancemethod(_xapian.TermGenerator_set_database, None, TermGenerator)
  4707. TermGenerator.set_flags = new_instancemethod(_xapian.TermGenerator_set_flags, None, TermGenerator)
  4708. TermGenerator.index_text = new_instancemethod(_xapian.TermGenerator_index_text, None, TermGenerator)
  4709. TermGenerator.index_text_without_positions = new_instancemethod(_xapian.TermGenerator_index_text_without_positions, None, TermGenerator)
  4710. TermGenerator.increase_termpos = new_instancemethod(_xapian.TermGenerator_increase_termpos, None, TermGenerator)
  4711. TermGenerator.get_termpos = new_instancemethod(_xapian.TermGenerator_get_termpos, None, TermGenerator)
  4712. TermGenerator.set_termpos = new_instancemethod(_xapian.TermGenerator_set_termpos, None, TermGenerator)
  4713. TermGenerator.__str__ = new_instancemethod(_xapian.TermGenerator___str__, None, TermGenerator)
  4714. TermGenerator_swigregister = _xapian.TermGenerator_swigregister
  4715. TermGenerator_swigregister(TermGenerator)
  4716.  
  4717. class Sorter(object):
  4718.     '''
  4719.     Virtual base class for sorter functor. 
  4720.     '''
  4721.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4722.     __repr__ = _swig_repr
  4723.     __swig_destroy__ = _xapian.delete_Sorter
  4724.     
  4725.     def __init__(self, *args):
  4726.         if self.__class__ == Sorter:
  4727.             args = (None,) + args
  4728.         else:
  4729.             args = (self,) + args
  4730.         _xapian.Sorter_swiginit(self, _xapian.new_Sorter(*args))
  4731.  
  4732.     
  4733.     def __disown__(self):
  4734.         self.this.disown()
  4735.         _xapian.disown_Sorter(self)
  4736.         return weakref_proxy(self)
  4737.  
  4738.  
  4739. Sorter.__call__ = new_instancemethod(_xapian.Sorter___call__, None, Sorter)
  4740. Sorter_swigregister = _xapian.Sorter_swigregister
  4741. Sorter_swigregister(Sorter)
  4742.  
  4743. class MultiValueSorter(Sorter):
  4744.     '''
  4745.     Sorter subclass which sorts by a several values.
  4746.  
  4747.     Results are ordered by the first value. In the event of a tie, the
  4748.     second is used. If this is the same for both, the third is used, and
  4749.     so on. 
  4750.     '''
  4751.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4752.     __repr__ = _swig_repr
  4753.     
  4754.     def __init__(self, *args):
  4755.         '''
  4756.         Xapian::MultiValueSorter::MultiValueSorter(Iterator begin, Iterator
  4757.         end) 
  4758.         '''
  4759.         _xapian.MultiValueSorter_swiginit(self, _xapian.new_MultiValueSorter(*args))
  4760.  
  4761.     
  4762.     def add(*args):
  4763.         '''
  4764.         void
  4765.         Xapian::MultiValueSorter::add(Xapian::valueno valno, bool
  4766.         forward=true) 
  4767.         '''
  4768.         return _xapian.MultiValueSorter_add(*args)
  4769.  
  4770.     __swig_destroy__ = _xapian.delete_MultiValueSorter
  4771.  
  4772. MultiValueSorter.add = new_instancemethod(_xapian.MultiValueSorter_add, None, MultiValueSorter)
  4773. MultiValueSorter_swigregister = _xapian.MultiValueSorter_swigregister
  4774. MultiValueSorter_swigregister(MultiValueSorter)
  4775. __docformat__ = 'restructuredtext en'
  4776.  
  4777. class _SequenceMixIn(object):
  4778.     '''Simple mixin class which provides a sequence API to a class.
  4779.  
  4780.     This is used to support the legacy API to iterators used for releases of
  4781.     Xapian earlier than 1.0.  It will be removed once this legacy API is
  4782.     removed in release 1.1.
  4783.  
  4784.     '''
  4785.     __slots__ = ('_sequence_items',)
  4786.     
  4787.     def __init__(self, *args):
  4788.         """Initialise the sequence.
  4789.  
  4790.         *args holds the list of properties or property names to be returned, in
  4791.         the order they are returned by the sequence API.
  4792.         
  4793.         If an item in the list is a string, it is considered to be a property
  4794.         name; otherwise, it is considered to be a property value, and is
  4795.         returned without doing an attribute lookup.  (Yes, this is a nasty
  4796.         hack.  No, I don't care, because this is only a temporary piece of
  4797.         internal code.)
  4798.  
  4799.         """
  4800.         self._sequence_items = args
  4801.  
  4802.     
  4803.     def __len__(self):
  4804.         """Get the length of the sequence.
  4805.  
  4806.         Doesn't evaluate any of the lazily evaluated properties.
  4807.  
  4808.         """
  4809.         return len(self._sequence_items)
  4810.  
  4811.     
  4812.     def _get_single_item(self, index):
  4813.         '''Get a single item.
  4814.  
  4815.         Used by __getitem__ to get individual items.
  4816.  
  4817.         '''
  4818.         if not isinstance(index, basestring):
  4819.             return index
  4820.         return getattr(self, index)
  4821.  
  4822.     
  4823.     def __getitem__(self, key):
  4824.         '''Get an item, or a slice of items, from the sequence.
  4825.  
  4826.         If any of the items are lazily evaluated properties, they will be
  4827.         evaluated here.
  4828.  
  4829.         '''
  4830.         if isinstance(key, slice):
  4831.             return [ self._get_single_item(i) for i in self._sequence_items[key] ]
  4832.         return self._get_single_item(self._sequence_items[key])
  4833.  
  4834.     
  4835.     def __iter__(self):
  4836.         '''Make an iterator for over the sequence.
  4837.  
  4838.         This simply copies the items into a list, and returns an iterator over
  4839.         it.  Any lazily evaluated properties will be evaluated here.
  4840.  
  4841.         '''
  4842.         return iter(self[:])
  4843.  
  4844.  
  4845.  
  4846. class MSetItem(_SequenceMixIn):
  4847.     '''An item returned from iteration of the MSet.
  4848.  
  4849.     The item supports access to the following attributes and properties:
  4850.  
  4851.      - `docid`: The Xapian document ID corresponding to this MSet item.
  4852.      - `weight`: The weight corresponding to this MSet item.
  4853.      - `rank`: The rank of this MSet item.  The rank is the position in the
  4854.        total set of matching documents of this item.  The highest document is
  4855.        given a rank of 0.  If the MSet did not start at the highest matching
  4856.        document, because a non-zero \'start\' parameter was supplied to
  4857.        get_mset(), the first document in the MSet will have a rank greater than
  4858.        0 (in fact, it will be equal to the value of \'start\' supplied to
  4859.        get_mset()).
  4860.      - `percent`: The percentage score assigned to this MSet item.
  4861.      - `document`: The document for this MSet item.  This can be used to access
  4862.        the document data, or any other information stored in the document (such
  4863.        as term lists).  It is lazily evaluated.
  4864.      - `collapse_key`: The value of the key which was used for collapsing.
  4865.      - `collapse_count`: An estimate of the number of documents that have been
  4866.        collapsed into this one.
  4867.  
  4868.     The collapse count estimate will always be less than or equal to the actual
  4869.     number of other documents satisfying the match criteria with the same
  4870.     collapse key as this document.  If may be 0 even though there are other
  4871.     documents with the same collapse key which satisfying the match criteria.
  4872.     However if this method returns non-zero, there definitely are other such
  4873.     documents.  So this method may be used to inform the user that there are
  4874.     "at least N other matches in this group", or to control whether to offer a
  4875.     "show other documents in this group" feature (but note that it may not
  4876.     offer it in every case where it would show other documents).
  4877.  
  4878.     '''
  4879.     __slots__ = ('_mset', '_firstitem', 'docid', 'weight', 'rank', 'percent', 'collapse_key', 'collapse_count', '_document')
  4880.     
  4881.     def __init__(self, iter, mset):
  4882.         self._mset = mset
  4883.         self._firstitem = self._mset.get_firstitem()
  4884.         self.docid = iter.get_docid()
  4885.         self.weight = iter.get_weight()
  4886.         self.rank = iter.get_rank()
  4887.         self.percent = iter.get_percent()
  4888.         self.collapse_key = iter.get_collapse_key()
  4889.         self.collapse_count = iter.get_collapse_count()
  4890.         self._document = None
  4891.         _SequenceMixIn.__init__(self, 'docid', 'weight', 'rank', 'percent', 'document')
  4892.  
  4893.     
  4894.     def _get_document(self):
  4895.         if self._document is None:
  4896.             self._document = self._mset._get_hit_internal(self.rank - self._firstitem).get_document()
  4897.         
  4898.         return self._document
  4899.  
  4900.     
  4901.     def get_docid(self):
  4902.         '''Deprecated method: use the `docid` property instead.'''
  4903.         return self.docid
  4904.  
  4905.     
  4906.     def get_weight(self):
  4907.         '''Deprecated method: use the `weight` property instead.'''
  4908.         return self.weight
  4909.  
  4910.     
  4911.     def get_rank(self):
  4912.         '''Deprecated method: use the `rank` property instead.'''
  4913.         return self.rank
  4914.  
  4915.     
  4916.     def get_percent(self):
  4917.         '''Deprecated method: use the `percent` property instead.'''
  4918.         return self.percent
  4919.  
  4920.     
  4921.     def get_collapse_key(self):
  4922.         '''Deprecated method: use the `collapse_key` property instead.'''
  4923.         return self.collapse_key
  4924.  
  4925.     
  4926.     def get_collapse_count(self):
  4927.         '''Deprecated method: use the `collapse_count` property instead.'''
  4928.         return self.collapse_count
  4929.  
  4930.     
  4931.     def get_document(self):
  4932.         '''Deprecated method: use the `document` property instead.'''
  4933.         return self.document
  4934.  
  4935.     document = property(_get_document, doc = 'The document object corresponding to this MSet item.')
  4936.  
  4937.  
  4938. class MSetIter(object):
  4939.     '''An iterator over the items in an MSet.
  4940.  
  4941.     The iterator will return MSetItem objects, which will be evaluated lazily
  4942.     where appropriate.
  4943.  
  4944.     '''
  4945.     __slots__ = ('_iter', '_end', '_mset')
  4946.     
  4947.     def __init__(self, mset):
  4948.         self._iter = mset.begin()
  4949.         self._end = mset.end()
  4950.         self._mset = mset
  4951.  
  4952.     
  4953.     def __iter__(self):
  4954.         return self
  4955.  
  4956.     
  4957.     def next(self):
  4958.         if self._iter == self._end:
  4959.             raise StopIteration
  4960.         self._iter == self._end
  4961.         r = MSetItem(self._iter, self._mset)
  4962.         self._iter.next()
  4963.         return r
  4964.  
  4965.  
  4966.  
  4967. def _mset_gen_iter(self):
  4968.     '''Return an iterator over the MSet.
  4969.  
  4970.     The iterator will return MSetItem objects, which will be evaluated lazily
  4971.     where appropriate.
  4972.  
  4973.     '''
  4974.     return MSetIter(self)
  4975.  
  4976. MSet.__iter__ = _mset_gen_iter
  4977. MSet.__len__ = MSet.size
  4978. MSet._get_hit_internal = MSet.get_hit
  4979.  
  4980. def _mset_getitem(self, index):
  4981.     '''Get an item from the MSet.
  4982.  
  4983.     The supplied index is relative to the start of the MSet, not the absolute
  4984.     rank of the item.
  4985.  
  4986.     Returns an MSetItem.
  4987.  
  4988.     '''
  4989.     if index < 0:
  4990.         index += len(self)
  4991.     
  4992.     if index < 0 or index >= len(self):
  4993.         raise IndexError('Mset index out of range')
  4994.     index >= len(self)
  4995.     return MSetItem(self._get_hit_internal(index), self)
  4996.  
  4997. MSet.__getitem__ = _mset_getitem
  4998. MSet.get_hit = _mset_getitem
  4999.  
  5000. def _mset_contains(self, index):
  5001.     '''Check if the Mset contains an item at the given index
  5002.  
  5003.     The supplied index is relative to the start of the MSet, not the absolute
  5004.     rank of the item.
  5005.  
  5006.     '''
  5007.     if key >= 0:
  5008.         pass
  5009.     return key < len(self)
  5010.  
  5011. MSet.__contains__ = _mset_contains
  5012.  
  5013. class ESetItem(_SequenceMixIn):
  5014.     '''An item returned from iteration of the ESet.
  5015.  
  5016.     The item supports access to the following attributes:
  5017.  
  5018.      - `term`: The term corresponding to this ESet item.
  5019.      - `weight`: The weight corresponding to this ESet item.
  5020.  
  5021.     '''
  5022.     __slots__ = ('term', 'weight')
  5023.     
  5024.     def __init__(self, iter):
  5025.         self.term = iter.get_term()
  5026.         self.weight = iter.get_weight()
  5027.         _SequenceMixIn.__init__(self, 'term', 'weight')
  5028.  
  5029.  
  5030.  
  5031. class ESetIter(object):
  5032.     '''An iterator over the items in an ESet.
  5033.  
  5034.     The iterator will return ESetItem objects.
  5035.  
  5036.     '''
  5037.     __slots__ = ('_iter', '_end')
  5038.     
  5039.     def __init__(self, eset):
  5040.         self._iter = eset.begin()
  5041.         self._end = eset.end()
  5042.  
  5043.     
  5044.     def __iter__(self):
  5045.         return self
  5046.  
  5047.     
  5048.     def next(self):
  5049.         if self._iter == self._end:
  5050.             raise StopIteration
  5051.         self._iter == self._end
  5052.         r = ESetItem(self._iter)
  5053.         self._iter.next()
  5054.         return r
  5055.  
  5056.  
  5057.  
  5058. def _eset_gen_iter(self):
  5059.     '''Return an iterator over the ESet.
  5060.     
  5061.     The iterator will return ESetItem objects.
  5062.  
  5063.     '''
  5064.     return ESetIter(self)
  5065.  
  5066. ESet.__iter__ = _eset_gen_iter
  5067. ESet.__len__ = ESet.size
  5068.  
  5069. class TermListItem(_SequenceMixIn):
  5070.     '''An item returned from iteration of a term list.
  5071.  
  5072.     The item supports access to the following attributes and properties:
  5073.  
  5074.      - `term`: The term corresponding to this TermListItem.
  5075.      - `wdf`: The within document frequency of this term.
  5076.      - `termfreq`: The number of documents in the collection which are indexed
  5077.        by the term
  5078.      - `positer`: An iterator over the positions which the term appears at in
  5079.        the document.  This is only available until the iterator which returned
  5080.        this item next moves.
  5081.  
  5082.     '''
  5083.     __slots__ = ('_iter', 'term', '_wdf', '_termfreq')
  5084.     
  5085.     def __init__(self, iter, term):
  5086.         self._iter = iter
  5087.         self.term = term
  5088.         self._wdf = None
  5089.         self._termfreq = None
  5090.         if iter._has_wdf == TermIter.EAGER:
  5091.             self._wdf = iter._iter.get_wdf()
  5092.         
  5093.         if iter._has_termfreq == TermIter.EAGER:
  5094.             self._termfreq = iter._iter.get_termfreq()
  5095.         
  5096.         sequence = [
  5097.             'term',
  5098.             'wdf',
  5099.             'termfreq',
  5100.             'positer']
  5101.         if iter._has_wdf == TermIter.INVALID:
  5102.             sequence[1] = 0
  5103.         
  5104.         if iter._has_termfreq == TermIter.INVALID:
  5105.             sequence[2] = 0
  5106.         
  5107.         if iter._has_positions == TermIter.INVALID:
  5108.             sequence[3] = PositionIter()
  5109.         
  5110.         _SequenceMixIn.__init__(self, *sequence)
  5111.  
  5112.     
  5113.     def _get_wdf(self):
  5114.         """Get the within-document-frequency of the current term.
  5115.  
  5116.         This will raise a InvalidOperationError exception if the iterator this
  5117.         item came from doesn't support within-document-frequencies.
  5118.  
  5119.         """
  5120.         if self._wdf is None:
  5121.             if self._iter._has_wdf == TermIter.INVALID:
  5122.                 raise InvalidOperationError('Iterator does not support wdfs')
  5123.             self._iter._has_wdf == TermIter.INVALID
  5124.             if self.term is not self._iter._lastterm:
  5125.                 raise InvalidOperationError('Iterator has moved, and does not support random access')
  5126.             self.term is not self._iter._lastterm
  5127.             self._wdf = self._iter._iter.get_wdf()
  5128.         
  5129.         return self._wdf
  5130.  
  5131.     wdf = property(_get_wdf, doc = "The within-document-frequency of the current term (if meaningful).\n\n    This will raise a InvalidOperationError exception if the iterator\n    this item came from doesn't support within-document-frequencies.\n\n    ")
  5132.     
  5133.     def _get_termfreq(self):
  5134.         """Get the term frequency.
  5135.  
  5136.         This is the number of documents in the collection which are indexed by
  5137.         the term.
  5138.  
  5139.         This will raise a InvalidOperationError exception if the iterator this
  5140.         item came from doesn't support term frequencies.
  5141.  
  5142.         """
  5143.         if self._termfreq is None:
  5144.             if self._iter._has_termfreq == TermIter.INVALID:
  5145.                 raise InvalidOperationError('Iterator does not support term frequencies')
  5146.             self._iter._has_termfreq == TermIter.INVALID
  5147.             if self.term is not self._iter._lastterm:
  5148.                 raise InvalidOperationError('Iterator has moved, and does not support random access')
  5149.             self.term is not self._iter._lastterm
  5150.             self._termfreq = self._iter._iter.get_termfreq()
  5151.         
  5152.         return self._termfreq
  5153.  
  5154.     termfreq = property(_get_termfreq, doc = "The term frequency of the current term (if meaningful).\n\n    This is the number of documents in the collection which are indexed by the\n    term.\n\n    This will raise a InvalidOperationError exception if the iterator\n    this item came from doesn't support term frequencies.\n\n    ")
  5155.     
  5156.     def _get_positer(self):
  5157.         """Get a position list iterator.
  5158.  
  5159.         The iterator will return integers representing the positions that the
  5160.         term occurs at.
  5161.  
  5162.         This will raise a InvalidOperationError exception if the iterator this
  5163.         item came from doesn't support position lists, or if the iterator has
  5164.         moved on since the item was returned from it.
  5165.  
  5166.         """
  5167.         if self._iter._has_positions == TermIter.INVALID:
  5168.             raise InvalidOperationError('Iterator does not support position lists')
  5169.         self._iter._has_positions == TermIter.INVALID
  5170.         if self.term is not self._iter._lastterm:
  5171.             raise InvalidOperationError('Iterator has moved, and does not support random access')
  5172.         self.term is not self._iter._lastterm
  5173.         return PositionIter(self._iter._iter.positionlist_begin(), self._iter._iter.positionlist_end())
  5174.  
  5175.     positer = property(_get_positer, doc = "A position iterator for the current term (if meaningful).\n\n    The iterator will return integers representing the positions that the term\n    occurs at.\n\n    This will raise a InvalidOperationError exception if the iterator this item\n    came from doesn't support position lists, or if the iterator has moved on\n    since the item was returned from it.\n\n    ")
  5176.  
  5177.  
  5178. class TermIter(object):
  5179.     '''An iterator over a term list.
  5180.  
  5181.     The iterator will return TermListItem objects, which will be evaluated
  5182.     lazily where appropriate.
  5183.  
  5184.     '''
  5185.     __slots__ = ('_iter', '_end', '_has_termfreq', '_has_wdf', '_has_positions', '_return_strings', '_lastterm', '_moved')
  5186.     INVALID = 0
  5187.     LAZY = 1
  5188.     EAGER = 2
  5189.     
  5190.     def __init__(self, start, end, has_termfreq = INVALID, has_wdf = INVALID, has_positions = INVALID, return_strings = False):
  5191.         self._iter = start
  5192.         self._end = end
  5193.         self._has_termfreq = has_termfreq
  5194.         self._has_wdf = has_wdf
  5195.         self._has_positions = has_positions
  5196.         if not has_positions != TermIter.EAGER:
  5197.             raise AssertionError
  5198.         self._return_strings = return_strings
  5199.         self._lastterm = None
  5200.         self._moved = True
  5201.  
  5202.     
  5203.     def __iter__(self):
  5204.         return self
  5205.  
  5206.     
  5207.     def next(self):
  5208.         if not self._moved:
  5209.             self._iter.next()
  5210.             self._moved = True
  5211.         
  5212.         if self._iter == self._end:
  5213.             self._lastterm = None
  5214.             raise StopIteration
  5215.         self._iter == self._end
  5216.         self._lastterm = self._iter.get_term()
  5217.         self._moved = False
  5218.         if self._return_strings:
  5219.             return self._lastterm
  5220.         return TermListItem(self, self._lastterm)
  5221.  
  5222.     
  5223.     def skip_to(self, term):
  5224.         '''Skip the iterator forward.
  5225.  
  5226.         The iterator is advanced to the first term at or after the current
  5227.         position which is greater than or equal to the supplied term.
  5228.  
  5229.         If there are no such items, this will raise StopIteration.
  5230.  
  5231.         This returns the item which the iterator is moved to.  The subsequent
  5232.         item will be returned the next time that next() is called (unless
  5233.         skip_to() is called again first).
  5234.  
  5235.         '''
  5236.         if self._iter != self._end:
  5237.             self._iter.skip_to(term)
  5238.         
  5239.         if self._iter == self._end:
  5240.             self._lastterm = None
  5241.             self._moved = True
  5242.             raise StopIteration
  5243.         self._iter == self._end
  5244.         newterm = self._iter.get_term()
  5245.         if newterm != self._lastterm:
  5246.             self._lastterm = newterm
  5247.         
  5248.         self._moved = False
  5249.         if self._return_strings:
  5250.             return self._lastterm
  5251.         return TermListItem(self, self._lastterm)
  5252.  
  5253.  
  5254.  
  5255. def _enquire_gen_iter(self, which):
  5256.     '''Get an iterator over the terms which match a given match set item.
  5257.  
  5258.     The match set item to consider is specified by the `which` parameter, which
  5259.     may be a document ID, or an MSetItem object.
  5260.  
  5261.     The iterator will return string objects.
  5262.  
  5263.     '''
  5264.     if isinstance(which, MSetItem):
  5265.         which = which.docid
  5266.     
  5267.     return TermIter(self.get_matching_terms_begin(which), self.get_matching_terms_end(which), return_strings = True)
  5268.  
  5269. Enquire.matching_terms = _enquire_gen_iter
  5270. Enquire.get_matching_terms = _enquire_gen_iter
  5271.  
  5272. def _query_gen_iter(self):
  5273.     '''Get an iterator over the terms in a query.
  5274.  
  5275.     The iterator will return string objects.
  5276.  
  5277.     '''
  5278.     return TermIter(self.get_terms_begin(), self.get_terms_end(), return_strings = True)
  5279.  
  5280. Query.__iter__ = _query_gen_iter
  5281.  
  5282. def _database_gen_allterms_iter(self, prefix = None):
  5283.     '''Get an iterator over all the terms in the database.
  5284.  
  5285.     The iterator will return TermListItem objects, but these will not support
  5286.     access to wdf, or position information.
  5287.  
  5288.     Access to term frequency information is only available until the iterator
  5289.     has moved on.
  5290.  
  5291.     If prefix is supplied, only terms which start with that prefix will be
  5292.     returned.
  5293.  
  5294.     '''
  5295.     if prefix is None:
  5296.         return TermIter(self.allterms_begin(), self.allterms_end(), has_termfreq = TermIter.LAZY)
  5297.     return TermIter(self.allterms_begin(prefix), self.allterms_end(prefix), has_termfreq = TermIter.LAZY)
  5298.  
  5299. Database.__iter__ = _database_gen_allterms_iter
  5300. Database.allterms = _database_gen_allterms_iter
  5301.  
  5302. def _database_gen_termlist_iter(self, docid):
  5303.     '''Get an iterator over all the terms which index a given document ID.
  5304.  
  5305.     The iterator will return TermListItem objects.
  5306.  
  5307.     Access to term frequency and position information is only available until
  5308.     the iterator has moved on.
  5309.  
  5310.     '''
  5311.     return TermIter(self.termlist_begin(docid), self.termlist_end(docid), has_termfreq = TermIter.LAZY, has_wdf = TermIter.EAGER, has_positions = TermIter.LAZY)
  5312.  
  5313. Database.termlist = _database_gen_termlist_iter
  5314.  
  5315. def _database_gen_spellings_iter(self):
  5316.     '''Get an iterator which returns all the spelling correction targets
  5317.  
  5318.     The iterator will return TermListItem objects.  Only the term frequency is
  5319.     available; wdf and positions are not meaningful.
  5320.  
  5321.     '''
  5322.     return TermIter(self.spellings_begin(), self.spellings_end(), has_termfreq = TermIter.EAGER, has_wdf = TermIter.INVALID, has_positions = TermIter.INVALID)
  5323.  
  5324. Database.spellings = _database_gen_spellings_iter
  5325.  
  5326. def _database_gen_synonyms_iter(self, term):
  5327.     '''Get an iterator which returns all the synonyms for a given term.
  5328.  
  5329.     The term to return synonyms for is specified by the `term` parameter.
  5330.  
  5331.     The iterator will return string objects.
  5332.  
  5333.     '''
  5334.     return TermIter(self.synonyms_begin(term), self.synonyms_end(term), return_strings = True)
  5335.  
  5336. Database.synonyms = _database_gen_synonyms_iter
  5337.  
  5338. def _database_gen_synonym_keys_iter(self, prefix = ''):
  5339.     '''Get an iterator which returns all the terms which have synonyms.
  5340.  
  5341.     The iterator will return string objects.
  5342.  
  5343.     If `prefix` is non-empty, only terms with this prefix are returned.
  5344.  
  5345.     '''
  5346.     return TermIter(self.synonym_keys_begin(prefix), self.synonym_keys_end(prefix), return_strings = True)
  5347.  
  5348. Database.synonym_keys = _database_gen_synonym_keys_iter
  5349.  
  5350. def _document_gen_termlist_iter(self):
  5351.     '''Get an iterator over all the terms in a document.
  5352.  
  5353.     The iterator will return TermListItem objects.
  5354.  
  5355.     Access to term frequency and position information is only available until
  5356.     the iterator has moved on.
  5357.  
  5358.     Note that term frequency information is only meaningful for a document
  5359.     retrieved from a database.  If term frequency information is requested for
  5360.     a document which was freshly created, an InvalidOperationError will be
  5361.     raised.
  5362.  
  5363.     '''
  5364.     return TermIter(self.termlist_begin(), self.termlist_end(), has_termfreq = TermIter.LAZY, has_wdf = TermIter.EAGER, has_positions = TermIter.LAZY)
  5365.  
  5366. Document.__iter__ = _document_gen_termlist_iter
  5367. Document.termlist = _document_gen_termlist_iter
  5368.  
  5369. def _queryparser_gen_stoplist_iter(self):
  5370.     '''Get an iterator over all the stopped terms from the previous query.
  5371.     
  5372.     This returns an iterator over all the terms which were omitted from the
  5373.     previously parsed query due to being considered to be stopwords.  Each
  5374.     instance of a word omitted from the query is represented in the returned
  5375.     list, in the order in which the
  5376.  
  5377.     The iterator will return string objects.
  5378.  
  5379.     '''
  5380.     return TermIter(self.stoplist_begin(), self.stoplist_end(), return_strings = True)
  5381.  
  5382. QueryParser.stoplist = _queryparser_gen_stoplist_iter
  5383.  
  5384. def _queryparser_gen_unstemlist_iter(self, tname):
  5385.     '''Get an iterator over all the unstemmed forms of a stemmed term.
  5386.     
  5387.     This returns an iterator which returns all the unstemmed words which were
  5388.     stemmed to the stemmed form specifed by `tname` when parsing the previous
  5389.     query.  Each instance of a word which stems to `tname` is returned by the
  5390.     iterator in the order in which the words appeared in the query - an
  5391.     individual unstemmed word may thus occur multiple times.
  5392.  
  5393.     The iterator will return string objects.
  5394.  
  5395.     '''
  5396.     return TermIter(self.unstem_begin(tname), self.unstem_end(tname), return_strings = True)
  5397.  
  5398. QueryParser.unstemlist = _queryparser_gen_unstemlist_iter
  5399.  
  5400. class PostingItem(_SequenceMixIn):
  5401.     '''An item returned from iteration of a posting list.
  5402.  
  5403.     The item supports access to the following attributes and properties:
  5404.  
  5405.      - `docid`: The document ID corresponding to this PostingItem.
  5406.      - `doclength`: The length of the document corresponding to this
  5407.        PostingItem.
  5408.      - `wdf`: The within document frequency of the term which the posting list
  5409.        is for in the document corresponding to this PostingItem.
  5410.      - `positer`: An iterator over the positions which the term corresponing to
  5411.        this posting list occurs at in the document corresponding to this
  5412.        PostingItem.  This is only available until the iterator which returned
  5413.        this item next moves.
  5414.  
  5415.     '''
  5416.     __slots__ = ('_iter', 'docid', 'doclength', 'wdf')
  5417.     
  5418.     def __init__(self, iter):
  5419.         self._iter = iter
  5420.         self.docid = iter._iter.get_docid()
  5421.         self.doclength = iter._iter.get_doclength()
  5422.         self.wdf = iter._iter.get_wdf()
  5423.         sequence = [
  5424.             'docid',
  5425.             'doclength',
  5426.             'wdf',
  5427.             'positer']
  5428.         if not iter._has_positions:
  5429.             sequence[3] = PositionIter()
  5430.         
  5431.         _SequenceMixIn.__init__(self, *sequence)
  5432.  
  5433.     
  5434.     def _get_positer(self):
  5435.         """Get a position list iterator.
  5436.  
  5437.         The iterator will return integers representing the positions that the
  5438.         term occurs at in the document corresponding to this PostingItem.
  5439.  
  5440.         This will raise a InvalidOperationError exception if the iterator this
  5441.         item came from doesn't support position lists, or if the iterator has
  5442.         moved on since the item was returned from it.
  5443.  
  5444.         """
  5445.         if not self._iter._has_positions:
  5446.             raise InvalidOperationError('Iterator does not support position lists')
  5447.         self._iter._has_positions
  5448.         if self._iter._iter == self._iter._end or self.docid != self._iter._iter.get_docid():
  5449.             raise InvalidOperationError('Iterator has moved, and does not support random access')
  5450.         self.docid != self._iter._iter.get_docid()
  5451.         return PositionIter(self._iter._iter.positionlist_begin(), self._iter._iter.positionlist_end())
  5452.  
  5453.     positer = property(_get_positer, doc = "A position iterator for the current posting (if meaningful).\n\n    The iterator will return integers representing the positions that the term\n    occurs at.\n\n    This will raise a InvalidOperationError exception if the iterator this item\n    came from doesn't support position lists, or if the iterator has moved on\n    since the item was returned from it.\n\n    ")
  5454.  
  5455.  
  5456. class PostingIter(object):
  5457.     '''An iterator over a posting list.
  5458.  
  5459.     The iterator will return PostingItem objects, which will be evaluated
  5460.     lazily where appropriate.
  5461.  
  5462.     '''
  5463.     __slots__ = ('_iter', '_end', '_has_positions', '_moved')
  5464.     
  5465.     def __init__(self, start, end, has_positions = False):
  5466.         self._iter = start
  5467.         self._end = end
  5468.         self._has_positions = has_positions
  5469.         self._moved = True
  5470.  
  5471.     
  5472.     def __iter__(self):
  5473.         return self
  5474.  
  5475.     
  5476.     def next(self):
  5477.         if not self._moved:
  5478.             self._iter.next()
  5479.             self._moved = True
  5480.         
  5481.         if self._iter == self._end:
  5482.             raise StopIteration
  5483.         self._iter == self._end
  5484.         self._moved = False
  5485.         return PostingItem(self)
  5486.  
  5487.     
  5488.     def skip_to(self, docid):
  5489.         '''Skip the iterator forward.
  5490.  
  5491.         The iterator is advanced to the first document with a document ID
  5492.         which is greater than or equal to the supplied document ID.
  5493.  
  5494.         If there are no such items, this will raise StopIteration.
  5495.  
  5496.         This returns the item which the iterator is moved to.  The subsequent
  5497.         item will be returned the next time that next() is called (unless
  5498.         skip_to() is called again first).
  5499.  
  5500.         '''
  5501.         if self._iter != self._end:
  5502.             self._iter.skip_to(docid)
  5503.         
  5504.         if self._iter == self._end:
  5505.             self._moved = True
  5506.             raise StopIteration
  5507.         self._iter == self._end
  5508.         self._moved = False
  5509.         return PostingItem(self)
  5510.  
  5511.  
  5512.  
  5513. def _database_gen_postlist_iter(self, tname):
  5514.     '''Get an iterator over the postings which are indexed by a given term.
  5515.  
  5516.     If `tname` is empty, an iterator over all the documents will be returned
  5517.     (this will contain one entry for each document, will always return a wdf of
  5518.     1, and will not allow access to a position iterator).
  5519.  
  5520.     '''
  5521.     if len(tname) != 0:
  5522.         return PostingIter(self.postlist_begin(tname), self.postlist_end(tname), has_positions = True)
  5523.     return PostingIter(self.postlist_begin(tname), self.postlist_end(tname))
  5524.  
  5525. Database.postlist = _database_gen_postlist_iter
  5526.  
  5527. class PositionIter(object):
  5528.     '''An iterator over a position list.
  5529.  
  5530.     The iterator will return integers, in ascending order.
  5531.  
  5532.     '''
  5533.     
  5534.     def __init__(self, start = 0, end = 0):
  5535.         self.iter = start
  5536.         self.end = end
  5537.  
  5538.     
  5539.     def __iter__(self):
  5540.         return self
  5541.  
  5542.     
  5543.     def next(self):
  5544.         if self.iter == self.end:
  5545.             raise StopIteration
  5546.         self.iter == self.end
  5547.         r = self.iter.get_termpos()
  5548.         self.iter.next()
  5549.         return r
  5550.  
  5551.  
  5552.  
  5553. def _database_gen_positionlist_iter(self, docid, tname):
  5554.     '''Get an iterator over all the positions in a given document of a term.
  5555.     
  5556.     The iterator will return integers, in ascending order.
  5557.  
  5558.     '''
  5559.     return PositionIter(self.positionlist_begin(docid, tname), self.positionlist_end(docid, tname))
  5560.  
  5561. Database.positionlist = _database_gen_positionlist_iter
  5562.  
  5563. class ValueItem(_SequenceMixIn):
  5564.     '''An item returned from iteration of the values in a document.
  5565.  
  5566.     The item supports access to the following attributes:
  5567.  
  5568.      - `num`: The number of the value.
  5569.      - `value`: The contents of the value.
  5570.  
  5571.     '''
  5572.     __slots__ = ('num', 'value')
  5573.     
  5574.     def __init__(self, num, value):
  5575.         self.num = num
  5576.         self.value = value
  5577.         _SequenceMixIn.__init__(self, 'num', 'value')
  5578.  
  5579.  
  5580.  
  5581. class ValueIter(object):
  5582.     '''An iterator over all the values stored in a document.
  5583.  
  5584.     The iterator will return ValueItem objects, in ascending order of value number.
  5585.  
  5586.     '''
  5587.     
  5588.     def __init__(self, start, end):
  5589.         self.iter = start
  5590.         self.end = end
  5591.  
  5592.     
  5593.     def __iter__(self):
  5594.         return self
  5595.  
  5596.     
  5597.     def next(self):
  5598.         if self.iter == self.end:
  5599.             raise StopIteration
  5600.         self.iter == self.end
  5601.         r = ValueItem(self.iter.get_valueno(), self.iter.get_value())
  5602.         self.iter.next()
  5603.         return r
  5604.  
  5605.  
  5606.  
  5607. def _document_gen_values_iter(self):
  5608.     '''Get an iterator over all the values stored in a document.
  5609.  
  5610.     The iterator will return ValueItem objects, in ascending order of value number.
  5611.  
  5612.     '''
  5613.     return ValueIter(self.values_begin(), self.values_end())
  5614.  
  5615. Document.values = _document_gen_values_iter
  5616. __all__ = []
  5617. for item in dir():
  5618.     if item.startswith('_') and item.endswith('_swigregister') or item.endswith('Iterator'):
  5619.         continue
  5620.     
  5621.     __all__.append(item)
  5622.  
  5623. __all__ = tuple(__all__)
  5624. ValueRangeProcessor.__call__ = ValueRangeProcessor.__call
  5625.